Linux /etc/group 文件和 /etc/passwd 和 /etc/shadow 文件都是有关于系统管理员对用户和用户组管理时相关的文件。
将用户分组是 Linux 系统中对用户进行管理及控制访问权限的一种手段。每个用户都属于某个用户组;
用户组的所有信息都存放在 /etc/group 文件中。此文件的格式是由冒号 (:) 隔开的若干个字段,这些字段具体如下:
组名:口令:组号标识:组内用户列表
具体解释
组名
组名是用户组的名称,由数字和字母组成。与 /etc/group 中的登录名一样,组名不应该重复;
口令
口令字段存放的是用户组加密后的口令字。一般 Linux 系统的用户组都没有口令,即这个字段一般为空,或者是 * ;
组号标识
组号标识符与用户标识符类似,也是一个整数,被系统内部用来表示组。别称 GID ;
组内用户列表
是数组这个组的所有用户的列表。不同用户之间用逗号 (,) 分隔。这个用户组可能是用户的主组,也可能是附加组;
使用实例
命令
xxxxxxxxxx11cat /etc/group输出
xxxxxxxxxx291Qs-MacBook-Pro:dir3 qiu$ cat /etc/group2##3# Group Database4# 5# Note that this file is consulted directly only when the system is running6# in single-user mode. At other times this information is provided by7# Open Directory.8#9# See the opendirectoryd(8) man page for additional information about10# Open Directory.11##12nobody:*:-2:13nogroup:*:-1:14wheel:*:0:root15daemon:*:1:root16kmem:*:2:root17sys:*:3:root18tty:*:4:root19operator:*:5:root20mail:*:6:_teamsserver21bin:*:7:22procview:*:8:root23procmod:*:9:root24owner:*:10:25everyone:*:12:26_taskgated:*:13:_taskgated27group:*:16:28staff:*:20:root29...