[root@localhost ~]#groupdel 組名
通過前面的學習不難猜測出,使用 groupdel 命令刪除群組,其實就是刪除 /etc/gourp 文件和 /etc/gshadow 文件中有關目標群組的數據信息。[root@localhost ~]#grep "group1" /etc/group /etc/gshadow
/etc/group:group1:x:505:
/etc/gshadow:group1:!::
[root@localhost ~]#groupdel group1
[root@localhost ~]#grep "group1" /etc/group /etc/gshadow
[root@localhost ~]#
[root@localhost ~]# useradd temp
#運行如下命令,可以看到 temp 用戶建立的同時,還創建了 temp 群組,且將其作為 temp用戶的初始組(組ID都是 505)
[root@localhost ~]# grep "temp" /etc/passwd /etc/group /etc/gshadow
/etc/passwd:temp:x:505:505::/home/temp:/bin/bash
/etc/group:temp:x:505:
/etc/gshadow:temp:!::
#下面嘗試刪除 temp 群組
[root@localhost ~]# groupdel temp
groupdel:cannot remove the primary group of user 'temp'
新聞熱點
疑難解答