Scenario
A new project is launching. You need UNIX groups for access control and shared ownership. The ticket specifies required groups and reserved GIDs for standards compliance, and you must verify the groups exist via NSS.
Create groups: developers, qa,
devops. Reserved GIDs:
docker=1050, devops=1200. Verify
via getent group.
Objective
-
Create
developersandqawith default GIDs. -
Create
devopswith reserved GID1200. -
Create
dockerwith reserved GID1050. -
Verify all required groups exist via NSS using
getent group.
Concepts
- Groups support access control and shared ownership across users and services.
- Reserved GIDs prevent collisions and keep IDs consistent across fleets and environments.
-
groupadd -gsets an explicit numeric GID to meet standards. -
getentverifies state via NSS and is preferred over grepping local files for operational proof.
Walkthrough
groupadd developers && groupadd qa && groupadd -g 1200 devops
This creates the baseline groups and enforces the reserved
GID for devops exactly as specified by the
ticket. Using a single command sequence keeps the workflow
deterministic and audit-friendly.
docker with reserved GID 1050.
groupadd -g 1050 docker
This reserves docker to the required numeric ID,
avoiding drift across hosts and ensuring predictable file
ownership and group-based access control.
getent.
getent group developers && getent group qa && getent group docker && getent group devops
This is the operational proof step. getent
validates the same group databases the system will consult,
which is the correct verification method in environments
using NSS-backed sources.
# Example output:
developers:x:1002:
qa:x:1100:
docker:x:1050:
devops:x:1200:
Common breakpoints
The group name is already present. Verify the existing group and confirm whether the ticket requires an explicit GID. If an existing group has the wrong GID, remediation must be planned before changing IDs.
The reserved GID is already assigned to another group. Identify the collision and resolve it according to your standards before proceeding.
NSS may be consulting a different source order, or the group creation did not persist. Re-run the creation step, confirm permissions, and check NSS configuration if the environment is directory-backed.
Cleanup checklist
This lab creates real groups. If you are using a shared or persistent training VM, remove the groups after practice only if your environment expects cleanup.
getent group developers
getent group qa
getent group docker
getent group devops
All four groups resolve via NSS and reserved GIDs match the ticket requirements.
Reference
-
groupadd <group>: Create a new group with the next available GID. -
groupadd -g <gid> <group>: Create a new group using an explicit numeric GID.-
-g <gid>: Sets the group ID to a specific value (reserved GID use case).
-
-
getent group <group>: Query group information through NSS (preferred verification method).