linux学习:增加user和sudo权限

来源:互联网 发布:java解压缩gz文件 编辑:程序博客网 时间:2024/05/01 17:18

linux

1.增加user

 /usr/sbin/useradd hjuser

password hjuser 为hjuser设置密码

*****

2.以这个user登录,sudo su的时候报错

“hjuser is not in the sudoers file. This incident will be reported.”

解决方法:

超级用户下

1)打开/etc/sudoers文件:$vi /etc/sudoers

2)找到这一 行:"root ALL=(ALL) ALL"在起下面添加"xxx ALL=(ALL) ALL"(这里的xxx是你的用户名),“wq!”保存并退出。 

"hjuser ALL=(ALL) ALL"


3.grep

grep 'ALL=' /etc/sudoers 

在/etc/sudoers中搜索包含“ALL=”的字符

0 0