su <user>
[harley] $ su weedlyPassword: <weedly_password>[weedly] $
[harley] $ su weedly
Password: <weedly_password>
[weedly] $
su - <user>
[harley] $ su - [root] # [root] 表示root可写可不写Password: <root_password>#
[harley] $ su - [root] # [root] 表示root可写可不写
Password: <root_password>
#
# exit[harley] $
# exit
[harley] $
[harley] $ sudo <command_name>[sudo] password for harley: <harley_password>
[harley] $ sudo <command_name>
[sudo] password for harley: <harley_password>
/etc/sudoers
$ su root
$ chmod u+w /etc/sudoers // 写权限
$ vi /etc/sudoers 打开sudoers文件,输入\Allow找到
$ vi /etc/sudoers
\Allow
## Allow root to run any commands anywhereroot ALL=(ALL) ALL<user_name> ALL=(ALL) ALL // 添加
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
<user_name> ALL=(ALL) ALL // 添加
$ chmod u-w /etc/sudoers // 撤销写权限
原文链接:http://www.cnblogs.com/dengguengseng/p/10551941.html
本站QQ群:前端 618073944 | Java 606181507 | Python 626812652 | C/C++ 612253063 | 微信 634508462 | 苹果 692586424 | C#/.net 182808419 | PHP 305140648 | 运维 608723728