User administrative rights Visudo
Example: Create user Kang, Grant yum privileges, useradd permissions [[email protected] ~]# useradd kang[[email protected] ~]# passwd kangchanging Password for user Kang. New Password:retype New Password:passwd:all authentication tokens updated successfully. [[email protected] ~]# tail-1/etc/passwdkang:x:501:502::/home/kang:/bin/bash[[email protected] ~]# Visudo #开通yum与useradd权限, if you need to open all permissions, please use all## allow ROOT to run any commands anywhereroot all = (All) Allzabbix all= (All) Allkang all= (All)/usr/sbin/useradd,/usr/bin/yum[[email protected] ~] $ sudo reboot #reboot no permissions [sudo] password for kang:sorry, user Kang was not allowed to execute '/sbin/reboot ' As Root on Localhost.localdomain. [[email protected] ~]$ sudo useradd test[sudo] password for kang: [[email protected] ~]$ tail-2/etc/passwdkang : x:501:502::/home/kang:/bin/bashtest:x:502:503::/home/test:/bin/bash[[email protected] ~]# visudo-c #配置文语法检查 /etc/sudoers:pArsed OK
User aliases, command alias usage tips
[[email protected] ~]# visudo User_Alias ADMIN = kang, test #ADMIN包括了用户kang, test Cmnd_Alias USERCMD = /usr/sbin/useradd #USERCMD包括可用useradd命令权限Cmnd_Alias NETWORKCMD = /sbin/ifconfig,/etc/init.d/network #NETWORKCMD命令包括ifconfig/network命令ADMIN ALL=(ALL) USERCMD, NETWORKCMD #授权用户命令使用
Remark explanation use
root ALL=(ALL) ALL用户/组 机器=角色 命令# User_Alias ADMINS = jsmith, mikem# Cmnd_Alias NETWORKING = /sbin/route, /sbin/ifconfig, /bin/ping, /sbin/dhclient, /usr/bin/net, /sbin/iptables, /usr/bin/rfcomm, /usr/bin/wvdial, /sbin/iwconfig
Linux User management rights Visudo