认识了帐号相关的两个文件/etc/passwd 与/etc/shadow之后,你或许还是会觉得奇怪,那么用户组的配置文件在哪里?还有,在/etc/passwd的第四列不是所谓的GID吗?那又是什么?此时就需要了解/etc/group与/etc/gshadow。
NAME
group
- user group file
DESCRIPTION
/etc/group is a text file which defines the groups on the system.
There is one entry per line, with the following format:
group_name:passwd:GID:user_list
The field descriptions are:
group_name
the name of the group.
password
the (encrypted) group password. If this field is empty, no
password is needed.
GID
the numerical group ID.
user_list
a list of the usernames that are members of this group, sepa‐rated by commas.
FILES
/etc/group
*****************
这个档案可以让你直接将账号所要支持的群组加进来!例如你有一个账号名称为
myaccount ,你想要让这个账号可以支持 root 这个群组,则你可以直接在 /etc/group
里面加入呢!很方便,不需要动用的指令呦!
root:x:0:root
bin:x:1:root,bin,daemon daemon:x:2:root,bin,daemon sys:x:3:root,bin,adm adm:x:4:root,adm,daemon |
这个内容也说明如下:
- 群组名称 :就是群组名称啦!
- 群组密码 :通常不需要设定,因为我们很少使用到群组登入!不过,同样的,密码也是被纪录在 /etc/gshadow 当中啰!
- 群组 ID :就是所谓的 GID 啦!
- 支持的账号名称 :这个群组里面的所有的账号,如上面所言,如果你想要让 mysccount 也属于 root 这个群组的话,那么就将上面的第一行最后面加上 ,myaccount (不要有空格)使成为『root:x:0:root,myaccount』就可以啦。