管理员 0,默认用户名称root
系统用户 rhel5/6 1-499 rhel7 1-999,特定服务的系统用户,特点权限比较小
普通用户 rhel5/6 1000-65535 rhel7 1000-+
[[email protected] Desktop]# useradd -u 8888 lence.zhou
[[email protected] Desktop]# id lence.zhou
uid=8888(lence.zhou) gid=8888(lence.zhou) groups=8888(lence.zhou)
修改用户的uid
usermod -u 666666 xiaozhang
[[email protected] Desktop]# id xiaozhang
uid=666666(xiaozhang) gid=1005(xiaozhang) groups=1005(xiaozhang)
[[email protected] Desktop]# usermod -u 666666 xiaozhang
usermod: no changes
[[email protected] Desktop]# id xiaozhang
uid=666666(xiaozhang) gid=1005(xiaozhang) groups=1005(xiaozhang)
添加扩展组
usermod -G itgroup xiaozhang
[[email protected] Desktop]# id xiaozhang
uid=666666(xiaozhang) gid=1005(xiaozhang) groups=1005(xiaozhang)
[[email protected] Desktop]# usermod -G itgroup xiaozhang
[[email protected] Desktop]# id xiaozhang
uid=666666(xiaozhang) gid=1005(xiaozhang) groups=1005(xiaozhang),8889(itgroup)
修改基本组
usermod -g 基本组 xiaozhang
用户组
创建用户组 groupadd
删除用户组里的用户,dd命令
vim /etc/group
删除用户
userdel xiaozhang
cd home目录,把xiaozhang的目录删掉
userdel -r zhangsan,彻底将用户及其家目录删掉
[[email protected] Desktop]# userdel xiaozhang
[[email protected] Desktop]# cd /home/
[[email protected] home]# ls
admins jack natasha sudan.lu xiaotong
bugle.pan lence.zhou ronny wangwu xiaozhang
cici.liu linuxprobe sampson.qiu wwwroot zhangsan
harry lisi sarah xiangxi.kong
[[email protected] home]# userdel -r zhagnsan
userdel: user ‘zhagnsan‘ does not exist
[[email protected] home]# userdel -r zhangsan
[[email protected] home]# ls
admins harry linuxprobe ronny sudan.lu xiangxi.kong
bugle.pan jack lisi sampson.qiu wangwu xiaotong
cici.liu lence.zhou natasha sarah wwwroot xiaozhang
原文:https://blog.51cto.com/sampsondotqiu/2490993