sudu的使用

# su user_name
切换用户,默认为root
 
# su - user_name
-:切换用户同时切换环境变量
 
# sudo command
临时使用root权限执行command
 
报错示例:user_name is not in the sudoers file.  This incident will be reported.
解决方法:
1、切换到root身份与root的环境变量
$ su -
2、 此处没有vi和sudo之间没有空格
# visudo
3、最后添加一行
user_name ALL=(ALL)  ALL
4、保存退出
posted @ 2018-05-03 21:48  史志磊  阅读(837)  评论(0编辑  收藏  举报