1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > CentOS下添加Root权限用户‘超级用户’方法(xxx is not in the sudoers file.T

CentOS下添加Root权限用户‘超级用户’方法(xxx is not in the sudoers file.T

时间:2021-01-14 15:05:10

相关推荐

CentOS下添加Root权限用户‘超级用户’方法(xxx is not in the sudoers file.T

文章目录

1.添加普通用户2.添加sudo文件的写权限3.编辑sudoers文件4.撤销sudoers文件写权限

1.添加普通用户

[root@server ~]# useradd fxd //添加一个名为fxd的用户

[root@server ~]# passwd fxd //修改密码

Changing password for user chenjiafa.

New UNIX password: //在这里输入新密码

Retype new UNIX password: //再次输入新密码

passwd: all authentication tokens updated successfully

2.添加sudo文件的写权限

命令是:

chmod u+w /etc/sudoers

3.编辑sudoers文件

vi /etc/sudoers

找到这行 root ALL=(ALL) ALL,在他下面添加xxx ALL=(ALL) ALL (这里的xxx是你的用户名)

ps:这里说下你可以sudoers添加下面四行中任意一条

youuser ALL=(ALL) ALL

%youuser ALL=(ALL) ALL

youuser ALL=(ALL) NOPASSWD: ALL

%youuser ALL=(ALL) NOPASSWD: ALL

第一行:允许用户youuser执行sudo命令(需要输入密码).

第二行:允许用户组youuser里面的用户执行sudo命令(需要输入密码).

第三行:允许用户youuser执行sudo命令,并且在执行的时候不输入密码.

第四行:允许用户组youuser里面的用户执行sudo命令,并且在执行的时候不输入密码.

4.撤销sudoers文件写权限

命令:

chmod u-w /etc/sudoers

这样普通用户就可以使用sudo了

CentOS下添加Root权限用户‘超级用户’方法(xxx is not in the sudoers file.This incident will be reported.的解决方法)

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。