具体操作步骤

1.首先我们建立一个账户,设置密码

[root@VM_0_13_centos home]# useradd 123
[root@VM_0_13_centos home]# passwd 123
Changing password for user better407.
New password: 
BAD PASSWORD: it is WAY too short
BAD PASSWORD: is too simple
Retype new password: 
passwd: all authentication tokens updated successfully.

2.运行visudo工具编辑/etc/sudoers 文件

[root@VM_0_13_centos /]# visudo

##
## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL

## Allows members of the 'sys' group to run networking, software,
## service management apps and more.
# %sys ALL = NETWORKING, SOFTWARE, SERVICES, STORAGE, DELEGATING, PROCESSES, LOCATE, DRIVERS

## Allows people in group wheel to run all commands  #在此添加
# %wheel        ALL=(ALL)       ALL
123            ALL=(ALL)       ALL

3.将123账户添加到root用户组

[root@VM_0_13_centos home]# usermod -aG root 123

4.执行到su命令切换到新建的用户123

[root@VM_0_13_centos /]# su 123
bash-4.1$ groups
123 root

  

 

相关文章:

  • 2022-02-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-26
  • 2021-11-27
  • 2021-09-09
猜你喜欢
  • 2021-11-10
  • 2021-12-31
  • 2022-12-23
  • 2022-01-12
  • 2021-11-13
  • 2021-07-24
  • 2021-08-14
相关资源
相似解决方案