xxx is not in the sudoers file 解决方法

用sudo時提示 "xxx is not in the sudoers file. This incident will be reported."

其中 XXX 是用戶名,
也就是你的用戶名沒有權限使用sudo
所以必須要修改 /etc/sudoers 文件


修改方法:

1.進入超級用戶模式
su

2.添加文件修改權限
chmod u+w /etc/sudoers

3.編輯 /etc/sudoers
vi /etc/sudoers

4.找到 root ALL = (ALL) ALL 後 ,按下 " i " 進入修改模式
在底下加入
xxx ALL = (ALL) ALL
( 備註 xxx 是用戶名稱 )

5.儲存修改並離開
按下 Esc 後,輸入 " :wq "

6.恢復文件修改權限
chmod u-w /etc/sudoers

沒有留言:

張貼留言