起因:
新建了一個(gè)用戶,運(yùn)行sudo時(shí)提示calvin is not in the sudoers file。于是:
1.嘗試把calvin用戶加入到sudoers文件中,具體位置是/etc/sudoers。
sudo chmod u+w /etc/sudoers,出現(xiàn)錯(cuò)誤:
sudo:/etc/sudoers is mode 0640, should be 0440
2.嘗試用su命令,
su - root
Password:
su: Authentication failure
Sorry.
此時(shí)已經(jīng)無法再繼續(xù),于是:
重啟進(jìn)入recovery模式:
root@XXX:~#sudo passwd root
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully.
3.退出,一切恢復(fù)正常。
參考:http://hi.baidu.com/shirdrn/blog/item/3b2d17cabc01118cc8176862.html