最近虛拟機裝了個redhat enterprise server 5,用慣了ubuntu,覺得不太适應。
當在終端執行sudo指令時,系統提示“cuser is not in the sudoers file”:
$ sudo ls
password:
cuser is not in the sudoers file. this incident will be reported.
其實就是沒有權限進行sudo,解決方法如下(這裡假設使用者名是cuser):
1.切換到超級使用者:$ su
2.打開/etc/sudoers檔案:$vi /etc/sudoers
3.修改檔案内容:
找到“root all=(all) all”一行,在下面插入新的一行,内容是“cuser all=(all) all”,然後在vi鍵入指令“wq!”儲存并退出。
注:這個檔案是隻讀的,不加“!”儲存會失敗。
4.退出超級使用者:$ exit
5.可以盡情使用sudo了。