天天看點

Ubuntu技巧之"xxx is not in the sudoers file"解決方法

原文位址:http://www.linuxidc.com/Linux/2010-12/30386.htm

      用sudo時提示"xxx is not in the sudoers file. This incident will be reported.其中XXX是你的使用者名,也就是你的使用者名沒有權限使用sudo,我們隻要修改一下/etc/sudoers檔案就行了。

1)進入超級使用者模式。也就是輸入"su -"

su -  

系統會讓你輸入超級使用者密碼,輸入密碼後就進入了超級使用者模式。也就是root使用者模式,為root使用者到密碼也是root。注意這裡有"-" ,這和su是不同的,在用指令”su”的時候隻是切換到root,但沒有把root的環境變量傳過去,還是目前使用者的環境變量,用”su -”指令将環境變量也一起帶過去,就象和root登入一樣。

2)添加檔案的寫權限。也就是輸入指令:

chmod u+w /etc/sudoers  

3)編輯/etc/sudoers檔案。也就是輸入指令:

gedit /etc/sudoers  

進入編輯模式,找到這一 行:

root ALL=(ALL) ALL  

在它的下面添加:

hadoop ALL=(ALL) ALL  

這裡的hadoop是你的使用者名,然後儲存退出。

4)撤銷檔案的寫權限。也就是輸入指令:

chmod u-w /etc/sudoers  

本文轉自xwdreamer部落格園部落格,原文連結:http://www.cnblogs.com/xwdreamer/archive/2010/12/09/2297060.html,如需轉載請自行聯系原作者

繼續閱讀