Skip to main content
Engineering LibreTexts

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

  • Page ID
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)

    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

    This page titled 02-C.11: Groups: Create, Modify, and Delete is shared under a CC BY-NC license and was authored, remixed, and/or curated by Patrick McClanahan.