248
技術社區[雲棲]
Linux中“is not in the sudoers file”解決方法
最近虛擬機裝了個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了。
最後更新:2017-04-02 04:01:45