3.3 linux用户管理 : 用户组CRUD(就是对/etc/group数据库进行修改)
在这里插入图片描述
1.常用命令
$ groupadd / addgroup <groupName> ##增加一个用户组
$ groupdel / delgroup <groupName> ##删除指定用户组
$ groups <userName> ##查看用户属于那些用户组
$ groupmod
2.groups查看指定用户属于那些用户组
groups userName
$ groups sgx
sgx : sgx adm cdrom sudo dip plugdev lpadmin sambashare
3.groupmod修改组的id
$ sudo groupmod -g 10021 test
$ cat /etc/group | grep test ##结果
test:x:10021:
4.groupmod 修改组的名称
$ sudo groupmod -n newtest test
$ cat /etc/group | grep test ##结果
newtest:x:10021:
5.groupmod 命令详解
Usage: groupmod [options] GROUP
Options:
-g, --gid GID change the group ID to GID ##改变group的id
-h, --help display this help message and exit ##display帮助信息并退出
-n, --new-name NEW_GROUP change the name to NEW_GROUP ##改变组的name
-o, --non-unique allow to use a duplicate (non-unique) GID ##允许使用一个non-unique的id
-p, --password PASSWORD change the password to this (encrypted) ##改变密码
PASSWORD
-R, --root CHROOT_DIR directory to chroot into ##chroot到的目录 改变根目录的位置