linux系统中创建用户组

1、查看用户组配置文件 /etc/group

[root@PC1linuxprobe test]# tail -n 5 /etc/group
insights:x:976:
avahi:x:70:
slocate:x:21:
tcpdump:x:72:
linuxprobe:x:1000:

 

2、创建用户组:grouptest

[root@PC1linuxprobe test]# groupadd grouptest
[root@PC1linuxprobe test]# tail -n 5 /etc/group
avahi:x:70:
slocate:x:21:
tcpdump:x:72:
linuxprobe:x:1000:
grouptest:x:1001:

 

3、创建用户组的同时制动用户组ID

[root@PC1linuxprobe test]# groupadd -g 6666 grouptest02
[root@PC1linuxprobe test]# tail -n 5 /etc/group
slocate:x:21:
tcpdump:x:72:
linuxprobe:x:1000:
grouptest:x:1001:
grouptest02:x:6666:

 

4、删除用户组

[root@PC1linuxprobe test]# groupdel grouptest02
[root@PC1linuxprobe test]# tail -n 5 /etc/group
avahi:x:70:
slocate:x:21:
tcpdump:x:72:
linuxprobe:x:1000:
grouptest:x:1001:

 

5、创建用户的同时指定用户组

[root@PC1linuxprobe test]# useradd -G grouptest usertest01
[root@PC1linuxprobe test]# tail -n 5 /etc/group
slocate:x:21:
tcpdump:x:72:
linuxprobe:x:1000:
grouptest:x:1001:usertest01
usertest01:x:1002:

 

posted @ 2020-11-16 18:43  小鲨鱼2018  阅读(1033)  评论(0编辑  收藏  举报