美文网首页
解决linux下普通用户用sudo执行命令时报错

解决linux下普通用户用sudo执行命令时报错

作者: basetree | 来源:发表于2019-08-09 13:50 被阅读0次

报错如下:

xxx is not in the sudoers file. This incident will be reported.
  1. 切换到root用户下
$ su
  1. 赋予 /etc/sudoers 文件读写权限
$ chmod 740 /etc/sudoers
  1. 编辑sudoers文件
$ vi /etc/sudoers

// 找到这行 root ALL=(ALL) ALL,在他下面添加 xxx ALL=(ALL) ALL (这里的xxx是你的用户名),比如
ROOT  ALL=(ALL)  ALL
tree  ALL=(ALL)  ALL
  1. 撤销sudoers文件写权限
$ chmod 540 /etc/sudoers

相关文章

网友评论

      本文标题:解决linux下普通用户用sudo执行命令时报错

      本文链接:https://www.haomeiwen.com/subject/hqthjctx.html