新建的用無法使用sudo命令,出現這樣的提示: 原來是新建的用戶沒在sudoers的管理文件中,那往裡添加不就完了嘛,以下是方法: 1.切換到root用戶。 2.添加sudoers文件寫的許可權。 3.編輯sudoers文件並添加相應的內容。 找到 在下麵仿寫一句 (註:在vim下,輸入請按:i鍵進入 ...
新建的用無法使用sudo命令,出現這樣的提示:
xiaojing is not in the sudoers file. This incident will be reported
原來是新建的用戶沒在sudoers的管理文件中,那往裡添加不就完了嘛,以下是方法:
1.切換到root用戶。
su root #接著系統會提示你輸入root用戶的密碼
2.添加sudoers文件寫的許可權。
chmod u+w /etc/sudoers
3.編輯sudoers文件並添加相應的內容。
vim /etc/sudoers
找到
# User privilege specification
root ALL=(ALL:ALL) ALL
在下麵仿寫一句
xiaojing ALL=(ALL:ALL) AL #xiaojing是新建的用戶
(註:在vim下,輸入請按:i鍵進入編輯模式,保存:先按ESC鍵進入命令模式,再輸入“:wq”保存退出)
4.撤銷sudoers文件的許可權。
chmod u-w /etc/sudoers
到此xiaojing可以使用sudo命令了。