Skip to main content
Engineering LibreTexts

02-C.11: Groups: Create, Modify, and Delete

  • Page ID
    2.2 Given a scenario, manage users and groups.

    Linux Groups

    In the previous task we discussed Linux users. There is another concept in Linux, that of groups, which is basically a logical mechanism to manage a collection of users. The idea of groups is to make it easy to manage several users that need access and permissions to a group of files, or commands on the system. The admin can assign each user to that group and allow them to have group access to files and commands. This is where the GID comes into use: it signifies which group(s) a user belongs to, and thereby, which access and permissions that user has.

    The /etc/group File

    This file, like the /etc/passwd file, is a colon separated file. It is much simpler than the passwd file, as it only has 4 fields:

    • Groupname - Contains the name assigned to the group.
    • Group-password (x) - x in this field indicates that shadow passwords are used.
    • GID - Contains the group’s GID number.
    • Username-list - Comma separated list of users that are members of the group.

    A typical /etc/groups file is shown below:

    security-team:x:133:pbmac, santiago, maida
    faculty:x:134:lisa, kathleen, salvador
    administration:x:135:laura, james

    Here is a breakdown of the fields from the first line in the example above.

    security-team:x:133:pbmac, santiago, maida
    [-----------] - [-] [---------------------]
         |        |  |            |
         |        |  |            |
         |        |  |    userid for those members of this group - there may be NO userids listed
         |        | GID
         |   group password
      group name