5.1.4 All group names and GIDs must be unique

Information

All groups should have a unique GID on the system.

Rationale:

All groups should have an individual and unique GID. If GID numbers are shared this could lead to undesirable file and directory access.

Solution

Examine the group IDs (GID) of all locally configured accounts:

cut -d: -f 3 /etc/group |sort -n | uniq -d

If the command has output there is at least one duplicate GID number. Determine any duplicates within the /etc/group file:

cut -d: -f 1 /etc/group | sort -n | uniq -d | while read GID; do
cut -f '1 3 4' -d : /etc/group | /usr/bin/sort -t: -k2n | grep ':${GID}:'
done

Examine the names of all locally configured groups:

cut -d: -f 1 /etc/group |sort -n | uniq -d

If the command has output there is at least one duplicate group name. Determine any duplicates within the /etc/group file:

cut -d: -f 1 /etc/passwd | sort -n | uniq -d | while read groupname; do
cut -f '1 3 4' -d : /etc/group | /usr/bin/sort -t: -k2n | grep '${groupname}:'
done

NOTE: Any duplicates returned should either be deleted or have the GID changed. Be careful. We recommend you examine any accounts assigned to a duplicate and ensure the account is neither losing nor gaining authorized group access through any remedial action.
To remove:

rmgroup <groupname>

To change the UID:

chgroup id=<id> <groupname>

Default Value:

N/A

See Also

https://workbench.cisecurity.org/benchmarks/13069

Item Details

Category: ACCESS CONTROL

References: 800-53|AC-2, CSCv7|16.6

Plugin: Unix

Control ID: 658ccf7377267583ed595f388afc2cb5eaa1456fbeeb9752f52e91e1cca450dc