linux學習之xxx is not in the sudoers file.This incident will be reported問題

Linux中普通用戶用sudo執行命令時報”xxx is not in the sudoers file.This incident will be reported”錯誤,解決方法就是在/etc/sudoers文件裏給該用戶添加權限。如下:

1.切換到root用戶下 
  方法爲直接在命令行輸入:su,然後輸入密碼(即你的登錄密碼,且密碼默認不可見)。

2./etc/sudoers文件默認是隻讀的,對root來說也是,因此需先添加sudoers文件的寫權限,命令是
即執行操作:chmod u+w /etc/sudoers

3.編輯sudoers文件 
即執行:vi /etc/sudoers 
找到這行 root ALL=(ALL) ALL,在他下面添加xxx ALL=(ALL) ALL (這裏的xxx是你的用戶名)

4.撤銷sudoers文件寫權限,命令
chmod u-w /etc/sudoers


發佈了80 篇原創文章 · 獲贊 11 · 訪問量 6萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章