Linux groups

A group in Linux is a collection of accounts that can be given special permissions on the system. For example, you can give one group the Read permission on a file and another group the Read/Write permissions on the same file. This way, the users in the first group can only read the file while the users in the second group can read and modify it.

Every user in Linux must have a primary group assigned. In most Linux distributions, the primary group is a group with the same name as the user. When a user creates files or launch programs, those files and running programs are associated with that group.

In the next example we will create a file while logged in as the user bob:

linux primary group

In the picture above you can see that the file we’ve just created is associated with the group named bob (the fourth field from the left represents the group the file is associated with).

The /etc/group file is a configuration file that stores group information. This file is readable by all users.
Geek University 2022