1.解決admin is not in the sudoers file. This incident will be reported.
php
先切換超級管理員用戶:su -html
cd /etc
vim
先修改其權限:增長用戶的寫權限,chmod u+w sudoers
ide
vim /etc/sudoersui
找到這行 root ALL=(ALL) ALL,在他下面添加url
username ALL=(ALL) ALLspa
保存退出,記得必定要把sudoers權限還原,不然會無效。3d
還原權限:chmod 440 sudoers
htm
2.解決sudo: no valid sudoers sources found, quittingci
設置普通用戶能夠使用sudo
chmod u+w /etc/sudoers
vi /etc/sudoers
找到這行 root ALL=(ALL) ALL,在他下面添加
username ALL=(ALL) ALL
可是返回後使用sudo時出現錯誤:sudo: no valid sudoers sources found, quittin
解決方法是須要將/etc/sudoers的權限恢復成440,就切換到普通用戶下去執行
sudo ifconfig
報如下錯誤:
sudo: /etc/sudoers is mode 0640, should be 0440
sudo: no valid sudoers sources found, quitting
退出普通用戶,在root下執行:
chmod u-w /etc/sudoers
或
chmod 440 /etc/sudoers