天天看點

admin is not in the sudoers file. This incident will be reported

原因

首先說一下,大家為什麼會走到這一步呢,不用說了,肯定是在裝系統或者買伺服器的時候沒有将admin賬号加入使用者組,使用sudo指令的時候,出現這個情況:

admin is not in the sudoers file. This incident will be reported

處理方式

1.切換到root使用者下

su

接着輸入root使用者的密碼

2.添加sudo檔案的寫權限,指令是:

chmod u+w /etc/sudoers

3.編輯sudoers檔案

vi /etc/sudoers

找到這行 root ALL=(ALL) ALL,在他下面添加xxx ALL=(ALL) ALL (這裡的xxx是你的使用者名)

admin is not in the sudoers file. This incident will be reported
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了.

繼續閱讀