Skip to content

7.2.6 Ensure no duplicate GIDs exist

Audit#

Run the following script and verify no results are returned:

1
2
3
4
5
6
7
8
#!/usr/bin/env bash
{
while read -r l_count l_gid; do
if [ "$l_count" -gt 1 ]; then
echo -e "Duplicate GID: \"$l_gid\" Groups: \"$(awk -F: '($3 == n) { print $1 }' n=$l_gid /etc/group | xargs)\""
fi
done < <(cut -f3 -d":" /etc/group | sort -n | uniq -c)
}

Remediation#

Based on the results of the audit script, establish unique GIDs and review all files owned by the shared GID to determine which group they are supposed to belong to.