我们在Linux系统上执行sudo命令时,有时候会报如下错误:xxx is not in the sudoers file. This incident will be reported。
出现这个问题,是因为执行sudo命令的用户不在sudoers文件的列表中。可以通过编辑sudoers文件,来解决这个问题。
编辑sudoers文件有两种办法,一种是以root帐号执行vi sudo,另一种是root帐号执行vi /etc/sudoers.其实两者都是修改/etc/sudoers。
假设你的用户名是“tuzhu”,属于“tuzhu”用户组。
为了让用户tuzhu能够执行sudo命,你可以在sudoers文件中加上一下四行的任意一行。
tuzhu ALL=(ALL) ALL
%tuzhu ALL=(ALL) ALL
tuzhu ALL=(ALL) NOPASSWD:ALL(出于方便,推荐使用此设置)
%tuzhu ALL=(ALL) NOPASSWD:ALL
说明:
第一行:允许用户tuzhu执行sudo命令(需要输入密码)。
第二行:允许用户组tuzhu里面的用户执行sudo命令(需要输入密码)。
第三行:允许用户tuzhui执行sudo命令,并且在执行的时候不输入密码。
第四行:允许用户组tuzhu里面的用户执行sudo命令,并且在执行的时候不输入密码。
当然如果你理解上面的原理后,可以直接输入如下命令解决此问题
su -
echo ‘xxx ALL=(ALL) ALL‘ >> /etc/sudoers (其中xxx代表用户名)
xxx is not in the sudoers file. This incident will be reported的解决方法,布布扣,bubuko.com
xxx is not in the sudoers file. This incident will be reported的解决方法
原文:http://blog.csdn.net/tuzhutuzhu/article/details/21286893