添加用户:

[root@localhost ~]# useradd -d /home/yaowen -m -s /bin/bash yaowen

更改用户密码:

passwd yaowen

查看当前组:

groups

id

删除用户:

 [root@localhost /]# userdel -r username

修改默认shell:

cat /etc/shells

chsh -s /bin/bash 

usermod -s /bin/zsh user

环境 centos 7.6, 添加管理员权限:(2022-01-04 更新)

sudo adduser -g wheel username # 添加有管理员权限用户

sudo usermod -G wheel username # 追加管理员权限

ubuntu 添加赋予管理员权限:(2019.10.14 更新)

sudo usermod -a -G adm new_username

sudo usermod -a -G sudo new_username

sudo usermod -a -G docker new_username # 容器管理员,2021年12月29日16:32:28

使用效果:(2022-01-04 17:24:26)

linux 添加用户并设置主目录,shell 并赋予权限 (以 fedora 和 ubuntu 为例); linux 添加用户管理员权限; 

相关博客链接:

https://www.cnblogs.com/xuyaowen/p/get-group-id.html

https://www.cnblogs.com/xuyaowen/p/linux-chsh.html 

 

相关文章:

  • 2021-12-17
  • 2022-12-23
  • 2022-12-23
  • 2021-08-06
  • 2021-12-19
  • 2021-12-03
  • 2022-12-23
猜你喜欢
  • 2021-08-12
  • 2021-12-23
  • 2022-12-23
  • 2022-01-13
  • 2021-12-19
  • 2022-12-23
相关资源
相似解决方案