我使用过的Linux命令之groupdel - 删除群组

我使用过的Linux命令之groupdel - 删除群组

本文链接:http://codingstandards.iteye.com/blog/1131042   (转载请注明出处)

用途说明

groupdel命令用来删除群组,该命令会把/etc/group和/etc/gshadow中相关的数据删除。群组名须存在(The named group must exist)。必须手动确认一下所有的文件系统,确保没有文件或目录没有使用此群组(You must manually check all file systems to insure that no files remain with the named group as the file group ID)。如果有任何一个用户账号属于该群组的话就不能移除该群组(You may not remove the primary group of any existing user)。 最好先移除使用者后再移除群组(You must remove the user before you remove the group)。注意:Linux上的中文手册实在不咋的,没法理解,如下所示。

man groupdel 写道
描述
groupdel 命令会修改系统帐号档,会删除所有已经存在的group. 群组名须存在。

你须手动确认一下所有的档案系统确保有没有档案还是没修正群组名变成群组ID。

警告
如果有任何一个群组的使用者在线上的话就不能移除该群组。最好先移除使用者后再移除群组。
 

常用参数

格式:groupdel {GROUP}

删除群组。

格式:groupadd {GROUP}

添加群组。

格式:useradd {USER}

添加用户,同时会自动创建同名群组。

格式:userdel {USER}

删除用户,同时会自动删除同名群组。

使用示例

示例一

[root@jfht ~]# useradd hello

[root@jfht ~]#
[root@jfht ~]# groupdel hello
groupdel:不能删除用户的主组。
[root@jfht ~]#

[root@jfht ~]# userdel hello
[root@jfht ~]# groupdel hello
groupdel:hello 组不存在
[root@jfht ~]#

问题思考

相关资料

【1】红联Linux110 Linux知识:删除用户和用户组的工具,userdel和groupdel介绍
http://www.linuxdiyf.com/viewarticle.php?id=31758
【2】朝着梦想 渐行前进 linux中groupadd、groupmod、groupdel、newgrp命令
http://blog.csdn.net/wh62592855/article/details/5744409
【3】murray-专注于网站建设及优化 如何在linux下使用userdel和 groupdel删除用户和用户组
http://www.murray.cn/index.php/2010/01/linux-userdel-groupdel-user-group/

返回 我使用过的Linux命令系列总目录

猜你喜欢

转载自codingstandards.iteye.com/blog/1131042