標籤:
1、添加使用者,首先用adduser命令添加一個普通使用者,命令如下:
#adduser tommy
//添加一個名為tommy的使用者
#passwd tommy //修改密碼
Changing password for user tommy.
New UNIX password: //在這裡輸入新密碼
Retype new UNIX password: //再次輸入新密碼
passwd: all authentication tokens updated successfully.
2.刪除使用者test:
userdel test
刪除使用者以及使用者目錄:
userdel -f test
xxx is not in the sudoers file.This incident will be reported.的解決方案
1.切換到root使用者下,怎麼切換就不用說了吧,不會的自己百度去.
2.添加sudo檔案的寫入權限,命令是:
chmod u+w /etc/sudoers
3.編輯sudoers檔案
vi /etc/sudoers
找到這行 root ALL=(ALL) ALL,在他下面添加xxx ALL=(ALL) ALL (這裡的xxx是你的使用者名稱)
ps:這裡說下你可以sudoers添加下面四行中任意一條
youuser ALL=(ALL) ALL
%youuser ALL=(ALL) ALL
youuser ALL=(ALL) NOPASSWD: ALL
%youuser ALL=(ALL) NOPASSWD: ALL
第一行:允許使用者youuser執行sudo命令(需要輸入密碼).
第二行:允許使用者組youuser裡面的使用者執行sudo命令(需要輸入密碼).
第三行:允許使用者youuser執行sudo命令,並且在執行的時候不輸入密碼.
第四行:允許使用者組youuser裡面的使用者執行sudo命令,並且在執行的時候不輸入密碼.
4.撤銷sudoers檔案寫入權限,命令:
chmod u-w /etc/sudoers
這樣普通使用者就可以使用sudo了.
centos添加和刪除使用者及 xxx is not in the sudoers file.This incident will be reported.的解決方案