is not in the sudoers file. This incident will be reported
What 我用的是CentOS6.3,在一般用户下执行sudo命令提示 “(我的用户名) is not in the sudoers file. This incident will be reported.” How 解决方法: 一、$whereis sudoers 找出文件所在的位置,默认都是/etc/sudoers 二、#chmod u+w /etc/sudoers 以超级用户登录su ,修改文件权限即添加文件拥有这的写权限,ls -al /etc/sudoers 可以查看原文件的权限。 三、vi /etc/sudoers 编辑文件,在root ALL=(ALL)ALL行下添加XXX ALL=(ALL)ALL,XXX为你的用户名。添加方法:找到root行,按下”i“键进入编辑模式添加即可!编辑好后esc键进入一般模式,“:wq"保存退出! 最后, #chmod u-w /etc/sudoers 回到文件的原权限! Why 详细: 在ubuntu中由于禁用了root用户,默认情况下会把安装系统时建立的用户添加到sudoers中。但在redhat系中并没有把任何root用户之外的用户默认的添加到sudoers之中。这样我们在执行sudo 命令时就会出现xxx is not in the sudoers file. This incident will be reported