xxx is not in the sudoers file.This incident will be reported.的解決方法
-
切換到root用戶下
-
添加sudo文件的寫權限
chmod u+w /etc/sudoers
-
編輯sudoers文件
vi /etc/sudoers
找到root ALL=(ALL) ALL
,在他下面添加xxx ALL=(ALL) ALL
(這里的xxx是你的用戶名)ps:這里說下你可以sudoers添加下面四行中任意一條
youuser ALL=(ALL) ALL %youuser ALL=(ALL) ALL youuser ALL=(ALL) NOPASSWD: ALL %youuser ALL=(ALL) NOPASSWD: ALL # 第一行:允許用戶youuser執行sudo命令(需要輸入密碼). # 第二行:允許用戶組youuser里面的用戶執行sudo命令(需要輸入密碼). # 第三行:允許用戶youuser執行sudo命令,並且在執行的時候不輸入密碼. # 第四行:允許用戶組youuser里面的用戶執行sudo命令,並且在執行的時候不輸入密碼.
-
撤銷sudoers文件寫權限,命令:
chmod u-w /etc/sudoers