Back to course

48. The `/etc/group` File and Secondary Groups

Linux Basics: From Zero to CLI Hero

Group Definitions

The /etc/group file defines all existing groups on the system and lists which users are members of those groups.

Structure

Each line defines one group, with 4 fields separated by colons (:):

group_name:password_placeholder:GID:member_list

Example Line:

sudo:x:27:alice,bob,charlie

Field Breakdown

  1. group_name: The name of the group (sudo).
  2. password_placeholder: Used for group passwords (rarely used, usually x).
  3. GID: Group ID number (27).
  4. member_list: A comma-separated list of users who are secondary members of this group. Users whose primary group is this group are not explicitly listed here.

This file is crucial for defining access controls, especially for shared resources and administrative roles (like the sudo group).