Both the Linux/etc/group file and the/etc/passwd and/etc/shadow files contain files related to the system administrator's management of users and user groups, the Linux/etc/group file has less content than the other two files. Here, the file is analyzed as follows.
All user group information is stored in the/etc/group file.
Grouping users is a way to manage users and control access permissions in Linux. Each user belongs to a user group. A group can contain multiple users, and a user can belong to different groups. When a user is a member of multiple groups at the same time, the main group to which the user belongs is recorded in the/etc/passwd file, that is, the default group to which the user belongs during logon, other groups are called additional groups.
To access files in an additional group, you must first use the newgrp command to make yourself a member of the group to be accessed. All user group information is stored in the/etc/group file. The format of this file is also similar to the/etc/passwd file. Several fields are separated by colons (:). These fields include:
Group Name: Password: Group ID: group user list
1) "group name" is the name of the user group, which consists of letters or numbers. Same as the login name in/etc/passwd, the group name should not be repeated.
2) The "password" field stores the encrypted password of the user group. Generally, users in Linux do not have a password, that is, this field is generally blank, or *.
3) the "Group ID" is similar to the user ID and is also an integer used internally to identify the group.
4) The "group user list" is a list of all users in this group/B]. Different users are separated by commas. This user group may be the user's primary group or an additional group.
An example of the/etc/group file is as follows: