[转]Linux下is not in the sudoers file解决方法

来源: http://jingyan.baidu.com/article/2a1383284bb3e8074a134f2d.html

当我们使用sudo命令切换用户的时候可能会遇到提示以下错误:xxx is not in the sudoers file. This incident will be reported,xxx是你当前的用户名,究其原因是用户没有加入到sudo的配置文件里

Linux下is not in the sudoers file解决方法

工具/原料

 
  • vi/vim

方法/步骤

 
  1. 1

    切换到root用户,运行visudo命令

    Linux下is not in the sudoers file解决方法
  2. 2

    在打开的配置文件中,找到root ALL=(ALL) ALL,在下面添加一行

    xxx ALL=(ALL) ALL 其中xxx是你要加入的用户名称

    Linux下is not in the sudoers file解决方法
  3. 3

    输入:wq保存并退出配置文件,再次使用sudo命令就不会有上面的提示了。

    END

注意事项

 
  • 编辑配置文件的时候最好使用visudo命令,否则可能会出现其他错误

posted @ 2017-09-25 23:34  胜强  阅读(167)  评论(0编辑  收藏  举报