1. 程式人生 > >CentOS7──xxx is not in the sudoers file

CentOS7──xxx is not in the sudoers file

command repo admin 直接 mod 用戶密碼 com 添加文件 local

提示"xxx is not in the sudoers file. This incident will be reported.其中 ”XXX“是你的用戶名,也就是你的用戶名沒有權限使用sudo,我們只要修改一下/etc/sudoers文件就行了。 下面是修改方法: 1)進入超級用戶模式。打開‘Open Terminal‘ 輸入"su",系統會讓你輸入超級用戶密碼,輸入密碼後就進入了超級用戶模式。(當然,你也可以直接用root權限2)添加文件的寫權限。"[[email protected] admin]"下,輸入命令"chmod u+w /etc/sudoers"。 3)編輯sudoers文件。輸入命令"vim /etc/sudoers",輸入"a"進入編輯模式,找到這一 行:"Allow root to ruan any commands anywhere"在【root ALL=(ALL) ALL
】下面一行添
加"xxx ALL=(ALL) ALL"(這裏的xxx是你的用戶名),然後保存(就是先按一 下Esc鍵,然後輸入":wq")退出。 4)撤銷sudoers文件的編寫權限。輸入命令"chmod u-w /etc/sudoers" 5)"XXX"用戶獲得了權限。

CentOS7──xxx is not in the sudoers file