catyuang

参考文章:CentOS 7中添加一个新用户并授权

# root 用户操作
$ 普通用户操作

创建用户

# adduser USERNAME
# passwd USERNAME (输入密码)

授权 root 权限

sudo 命令的授权管理是在sudoers文件里的。查看 sudoers 位置:
# whereis sudoers
查看 sudoers 的读写权限:
# ls -l /etc/sudoers
如果 sudoers 没有写权限则添加:
# chmod -v u+w /etc/sudoers
修改 sudoers:
# vim /etc/sudoers

找到 ## Allow root to run any commands anywher ,修改如下:
root ALL=(ALL) ALL
USERNAME ALL=(ALL) ALL # 这个是新增的用户

回收 sudoers 写权限:
# chmod -v u-w /etc/sudoers

使用$ sudo su命令,输入密码切换 root 用户

分类:

技术点:

相关文章:

  • 2021-10-24
  • 2021-10-04
  • 2021-12-03
  • 2021-09-07
  • 2021-12-02
  • 2021-11-22
  • 2021-09-06
猜你喜欢
  • 2021-11-27
  • 2021-11-22
  • 2021-06-02
  • 2021-10-24
  • 2021-12-29
  • 2021-10-08
相关资源
相似解决方案