红联Linux门户
Linux帮助

使用sudo时user is not in sudoers file的解决

发布时间:2015-10-22 16:00:35来源:linux网站作者:TheOneGIS

在Ubuntu下安装系统以后第一个创建的用户默认是在sudo用户组的,所以以sudo执行命令没有问题。

如果想让新添加的用户也能拥有使用sudo的权利,我们一般可以使用

adduser username sudo这样的命令将用户添加到sudo组中即可(username为你的用户名)

或者usermode -G username sudo。


在CentOS安装系统以后,默认创建的用户没有使用sudo的权限,会提示user is not in suoders files。

但是CentOS下没有sudo用户组,但是有一个wheel用户组。


解决办法:

首先su到root用户下,然后使用usermode -G username wheel。

(我尝试使用adduser username wheel不成功)


还有一种极端的办法是修改/etc/sudoers文件。

使用visudo命令在root ALL=(ALL)ALL行下添加usernameALL=(ALL)ALL(username为你的用户名)。

其实visudo命令是使用vi编辑/etc/sudoers文件,但是sudoers文件是只读文件,所以我们最好直接使用系统提供的visudo命令,这样可以直接编辑sudoers文件而不用修改文件属性。


解决xxx is not in the sudoers file.:http://www.linuxdiyf.com/linux/13839.html

Ubuntu下is not in the sudoers file问题解决:http://www.linuxdiyf.com/linux/12538.html

怎样解决“XXX is not in the sudoers file”错误:http://www.linuxdiyf.com/linux/9439.html

Ubuntu技巧之is not in the sudoers file解决方法:http://www.linuxdiyf.com/linux/9015.html

Linux下创建新用户出现XXX is not in the sudoers file.错误提示:http://www.linuxdiyf.com/linux/7605.html