解決Linux下無法使用sudo命令問題
阿新 • • 發佈:2018-06-07
sudo問題描述
使用普通用戶登錄後在終端中執行sudo命令時提示以下錯誤:
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
解決方法
一、 切換到root用戶
終端中執行 su
命令,然後輸入密碼,從普通用戶切換為根用戶
二、為sudoers配置文件添加寫權限
sudoers文件位於 /etc
目錄下,其為系統配置sudo用戶的一個只讀配置文件。在root身份下執行 chmod +w /etc/sudoers
命令為該文件添加寫權限。
三、編輯sudoers配置文件
執行 vi /etc/sudoers
命令對配置文件進行編輯。在文件中先找到
Allows people in group wheel to run all
commands
這段配置,然後在配置下方新起一行添加所需要增加 sudo
權限的用戶,格式如下
用戶名 ALL=(ALL) ALL
解決Linux下無法使用sudo命令問題