使用sudo命令报错:xxx is not in the sudoers file. This incident will be reported

150 阅读1分钟

切换到root用户

su -

修改配置文件:

vi /etc/sudoers

找到 root    ALL=(ALL)       ALL,在下面加一行自己的用户:

xxx  ALL=(ALL)   ALL
或:xxx  ALL=(ALL)   NOPASSWD: ALL  (不用密码)

保存退出:

wq!