歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Ubuntu報“xxx is not in the sudoers file.This incident will be reported” 錯誤解決方法

Ubuntu報“xxx is not in the sudoers file.This incident will be reported” 錯誤解決方法

日期:2017/2/28 13:51:10   编辑:Linux教程

Ubuntu下普通用戶用sudo執行命令時報"xxx is not in the sudoers file.This incident will be reported"錯誤,解決方法就是在/etc/sudoers文件裡給該用戶添加權限。如下:

1.切換到root用戶下

2./etc/sudoers文件默認是只讀的,對root來說也是,因此需先添加sudoers文件的寫權限,命令是:
chmod u+w /etc/sudoers

3.編輯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命令,並且在執行的時候不輸入密碼.

4.撤銷sudoers文件寫權限,命令:
chmod u-w /etc/sudoers

更多Ubuntu相關信息見Ubuntu 專題頁面 http://www.linuxidc.com/topicnews.aspx?tid=2

Copyright © Linux教程網 All Rights Reserved