linux給使用者添加sudo權限:
有時候,linux下面運作sudo指令,會提示類似:
xxxis not in the sudoers file. This incident will be reported.
這裡,xxx是使用者名稱,然後導緻無法執行sudo指令,這時候,如下解決:
進入超級使用者模式。也就是輸入"su -",系統會讓你輸入超級使用者密碼,輸入密碼後就進入了超級使用者模式。(當然,你也可以直接用root用)
添加檔案的寫權限。也就是輸入指令"chmod u+w /etc/sudoers"。
編輯/etc/sudoers檔案。也就是輸入指令"vim /etc/sudoers",進入編輯模式,找到這一 行:"root ALL=(ALL) ALL"在起下面添加"xxx ALL=(ALL) ALL"(這裡的xxx是你的使用者名),然後儲存退出。
撤銷檔案的寫權限。也就是輸入指令"chmod u-w /etc/sudoers"。
然後就行了。
http://blog.chinaunix.net/uid-25305993-id-126661.html