创建组
命令:groupadd 组名称
创建组 cangzhou,演示如下:root@pc-virtual-machine:/# groupadd cangzhou
root@pc-virtual-machine:/#
root@pc-virtual-machine:/#
删除组
命令:groupdel 组名称
删除组 cangzhou,演示如下:root@pc-virtual-machine:/# groupdel cangzhou
root@pc-virtual-machine:/#
root@pc-virtual-machine:/#
新建用户并指定组
命令:useradd -g 组名称 用户名称
演示如下:root@pc-virtual-machine:/# useradd -d "/home/shy1" -m -s "/bin/bash" -g cangzhou shy1
root@pc-virtual-machine:/# cd /home/shy1
root@pc-virtual-machine:/home/shy1# cd ../
root@pc-virtual-machine:/home# ls
pc shy1 xq
root@pc-virtual-machine:/home# ^C
root@pc-virtual-machine:/home#
修改用户组
命令: usermod -g 组名称 用户名称root@pc-virtual-machine:/# id shy1
uid=1007(shy1) gid=1007(chengde) 组=1007(chengde)
root@pc-virtual-machine:/# usermod -g cangzhou shy1
root@pc-virtual-machine:/# id shy1
uid=1007(shy1) gid=1006(cangzhou) 组=1006(cangzhou)
root@pc-virtual-machine:/#