红联Linux门户
Linux帮助

xxx is not in the sudoers file. This incident will be reported.

发布时间:2014-06-14 09:56:08来源:红联作者:velcbo
Linux中添加管理员权限问题。

在各个不同版本的linux中添加拥有管理员权限账户有不同的简便方式。

问题:

  今天遇见将新添用户添加到root用户组后,运行sudo仍然提示 ”xxx is not in the sudoers file. This incident will be reported.“ 的问题。经过分析是在/etc/sudoers中的用户组未指定该组拥有所有权限。

解决方法:

最好不要将用户添加到root用户组,不妨我们新建个用户组sudo :使用命令 sudo groupadd sudo
编辑/etc/sudoers:有些系统默认情况下不允许写该文件的,可使用命令:sudo chmod u+w /etc/sudoers 添加些权限,不要忘记编辑完成后改回来:命令 sudo chmod u-w /etc/sudoers
在/etc/sudoersz中添加一行:%sudo  ALL=(ALL)  ALL 。这样sudo用户组就拥有了sudo权限。
然后添加用户到sudo用户组中即可:sudo useradd username -G sudo
修改用户密码:password username
最好su username - 切换到该用户,测试sudo 命令是否可用。

来源:Linux社区
文章评论

共有 0 条评论