解决方法"/>
ubuntu出现“xxx is not in the sudoers file. This incident will be reported“解决方法
ubuntu1604下普通用户用sudo 执行命令时报 "xxx is not in the sudoers file. This incident will be reported"错误,解决方法就是在/etc/sudoers文件里给该用户添加权限。如下:
1.切换到root用户2./etc/sudoers 文件默认时只读的,对root来说也是,因此需先添加sudoers文件的写权限,命令是:chmod u+w /etc/sudoers3.编辑sudoers文件vim /etc/sudoers找到这行root ALL=(ALL) ALL,在他下面添加xxx ALL=(ALL) ALL(这里的xxx是你的用户名)ps:这里说下你可以sudoers添加下面四行中任意一条youruser ALL=(ALL) ALL%youruser ALL=(ALL) ALLyouruser ALL=(ALL) NOPASSWORD:ALL%youruser ALL=(ALL) NOPASSWORD:ALL 第一行:允许用户youruser执行sudo命令(需要输入密码)第二行:允许用户组youruser里面的用户执行sudo命令(需要输入密码)第三行:允许用户youruser执行sudo命令,并且在执行的时候不输入密码第四行:允许用户组youruser里面的用户执行sudo命令,并且在执行的时候不输入密码4.撤销sudoers文件写权限命令:chmod u-w /etc/sudoers
更多推荐
ubuntu出现“xxx is not in the sudoers file. This incident will be reported“解决方法
发布评论