centos添加和刪除使用者及 xxx is not in the sudoers file.This incident will be reported.的解決方案

來源:互聯網
上載者:User

標籤:

 

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.的解決方案

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.