Skip to content

7.2.8 Ensure no duplicate group names 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_group; do
if [ "$l_count" -gt 1 ]; then
echo -e "Duplicate Group: \"$l_group\" Groups: \"$(awk -F: '($1 == n) { print $1 }' n=$l_group /etc/group | xargs)\""
fi
done < <(cut -f1 -d":" /etc/group | sort -n | uniq -c)
}

Remediation#

Based on the results of the audit script, establish unique names for the user groups. File group ownerships will automatically reflect the change as long as the groups have unique GIDs.