將用戶賦予sudo權限:配置sudoers文件 xxx is not in the sudoers file.This incident will be reported.的解決方法

xxx is not in the sudoers file.This incident will be reported.的解決方法

 

1.切換到root用戶下,怎麼切換就不用說了吧,不會的本身百度去.

2.添加sudo文件的寫權限,命令是:
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

這樣普通用戶就可使用sudo了html

 
參考:
http://www.javashuo.com/article/p-ynfqkbiz-hz.html
相關文章
相關標籤/搜索