Understanding /etc/group file

In this post we are going to see format, content of /etc/group file. /etc/group (will be called as group file henceforth in this post) is popular file after /etc/passwd, when it comes to user in any Linux or Unix based system. Every administrator should be familiar with this file. Rather whenever one starts working on Linux Unix based system this file should be covered during his/her basis learning itself.

Group file is human readable file which contains information about user groups on system. Typical /etc/group file looks like below :

Since its normal text file, commands like cat, more will work without any issue on it.

If you observe above file, it has values separated by colons (:). Each row is one entry. One entry is for one group. For every group(row) there are 4 fields defined separated by colon. Those four fields are :

  1. Group name
  2. encrypted password for group
  3. group id
  4. group members

Lets see one by one :

Group name

Its a group name by which group is being identified for admins/humans. This name is used in all group management/user management related commands. New group name entry gets added in this file when groupadd command is used.

Encrypted password for group

Its password in encrypted format. In above example you see x instead of encrypted password since /etc/shadow file is generated on system. Encrypted password is found in /etc/gshadow file in such case.

Group id

Its numeric id assigned to group. Normally kernel identify group by this field. This ID also features in /etc/passwd file in 4th field. More information on GID can be found here. Group id gets generated automatically when group is created using groupadd command.

Group members

This is list of user names separated by commas which are member of this group. File or directory permissions assigned to group will be inherited to all these group members.

Any thoughts?