在某个用户(xxx)下使用sudo的时候,提示以下错误:xxx is not in the sudoers file. This incident will be reported

1、切换到root用户

xxx$:    su root

2、进入etc目录中

root#:  cd /etc

3、修改sudoers文件权限

root/etc#:  chmod u+w sudoers

4、添加用户的权限

root/etc#:  vim sudoers

root/etc#: xxx    ALL=(ALL)    ALL(找到root ALL=(ALL)    ALL下面添加

5、退出保存,修改sudoers的文件权限

root/etc#:  wq!

root/etc#:  chmod u-w sudoers

6、切换用户就可以了

猜你喜欢

转载自blog.csdn.net/a2392008643/article/details/83651906