I. Overview
The Linux group configuration (/etc/group) file is divided into 4 fields, namely:
Group name, group password, GID, and group member.
Ii. examples
[Email protected] ~]# Cat/etc/group | grep fruit
FRUIT:X:1001:
Where fruit is the group name, X is the group password, 1001 is GID, and the member field is empty.
The default group for users Apple and banana is fruit.
[[email protected] ~]# ID apple
uid=1001 (apple) gid=1001 (fruit) group =1001 (fruit)
[[email protected] ~]# ID Banana
uid=1002 (banana) gid=1001 (fruit) group =1001 (fruit)
There are 2 cases when the group member field is empty: (1) The groups do not contain users, and (2) the group contains users, but the above users are the default groups.
[Email protected] ~]# Cat/etc/group | grep fruit
FRUIT:X:1001:
Iii. issues
Question: When a user is displayed in the Group member field, is the group necessarily not the default group for this user?
Answer: No.
The user Apple appears in group trick, group trick is the default group for the user Apple.
[Email protected] ~]# Cat/etc/group | grep trick
Trick:x:1002:apple
[[email protected] ~]# ID apple
uid=1001 (apple) gid=1002 (trick) group =1002 (trick)
Cause analysis
When you create a user, Apple makes its default group fruit, adds it to group trick, and then modifies the user's Apple default group to group trick.
Linux group configuration file (/etc/group)