Skip to content

7.2.5 Ensure no duplicate UIDs 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_uid; do
if [ "$l_count" -gt 1 ]; then
echo -e "Duplicate UID: \"$l_uid\" Users: \"$(awk -F: '($3 == n) { print $1 }' n=$l_uid /etc/passwd | xargs)\""
fi
done < <(cut -f3 -d":" /etc/passwd | sort -n | uniq -c)
}

Remediation#

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