visudobash
用戶 機器=(極權那個角色的權利)ide
root ALL=(ALL) ALLui
stephen ALL=(ALL) /usr/sbin/useradd,/usr/sbin/userdelthree
[stephen@52game ~]$ sudo /usr/sbin/useradd kkkit
[sudo] password for stephen: class
Sorry, try again.變量
[sudo] password for stephen: file
[stephen@52game ~]$ id kkkrust
uid=501(kkk) gid=501(kkk) 組=501(kkk)權限
[stephen@52game ~]$ sudo /usr/sbin/useradd 380233718
[stephen@52game ~]$ id 380233718
uid=502(380233718) gid=502(380233718) 組=502(380233718)
[stephen@52game ~]$
注意:sudo是欽差大臣,不能少,不能修改修改rooot。
皇帝的太子
leader ALL=(ALL) ALL
[root@52game ~]# useradd leader
[root@52game ~]# passwd leader
不用告訴leader root密碼,能夠切換到root
[root@52game ~]# su - leader
[leader@52game ~]$ su -
密碼:
[leader@52game ~]$ sudo su -
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
[sudo] password for leader:
[root@52game ~]#
查詢本身權限
sudo -l
管理員用戶切換不須要密碼
stephen ALL=(ALL) NOPASSWD:ALL
[root@52game ~]# su - stephen
[stephen@52game ~]$ su -
密碼:
[stephen@52game ~]$ sudo su -
[root@52game ~]#
當即使環境變量生效
. .bash_profile
source .bash_profile