XXXX is not in the sudoers file. This incident will be reported解决方法

XXXX is not in the sudoers file.  This incident will be reported解决方法

假设你用的是Red Hat系列(包括Fedora和CentOS)的Linux系统。当你执行sudo命令时可能会提示“某某用户 is not in the sudoers file.  This incident will be reported.”

解决方法:编辑sudoers文件有两种办法,一种是以root帐号执行visudo,另一种是root帐号执行vi /etc/sudoers.其实两者都是修改/etc/sudoers。 

假设你的用户名是“92wiki”,属于“zhuxun”用户组。

为了让用户92wiki能够执行sudo命,你可以在sudoers文件中加上一下四行的任意一行。

    

zhuxun            ALL=(ALL)                ALL 

%zhuxun           ALL=(ALL)                ALL

zhuxun            ALL=(ALL)                NOPASSWD:ALL(出于方便,推荐使用此设置) 

%zhuxun           ALL=(ALL)                NOPASSWD:ALL


解释说明:
第一行:允许用户zhuxun执行sudo命令(需要输入密码)。 

第二行:允许用户组zhuxun里面的用户执行sudo命令(需要输入密码)。

第三行:允许用户zhuxun执行sudo命令,并且在执行的时候不输入密码。

第四行:允许用户组zhuxun里面的用户执行sudo命令,并且在执行的时候不输入密码。 

当然如果你理解上面的原理后,可以直接输入如下命令解决此问题

su -
echo 'xxx ALL=(ALL) ALL' >> /etc/sudoers  (其中xxx代表用户名) 

转载自:https://blog.csdn.net/zhu_xun/article/details/21087157

猜你喜欢

转载自blog.csdn.net/Qiana_/article/details/81841513