Other Articles

Servers – Ensure No Duplicate Group Names Exist

Support > Fixing Checks > Server

06 March, 2026

This check ensures that no duplicate group names exist in /etc/group.

Duplicate group names can occur if administrators manually modify the /etc/group file. This can lead to permission conflicts and unintended access, as multiple entries may share the same group identity.

Check Details

  • Resource: Server
  • Check: Ensure no duplicate group names exist
  • Risk: Duplicate group names can lead to shared permissions across unintended groups, resulting in security risks and improper access control.

Remediation Steps

  1. Open a terminal session on the server with root or sudo privileges.
  2. Run the following script to identify duplicate group names in /etc/group.

    #!/bin/bash
    
    cut -f1 -d":" /etc/group | sort -n | uniq -c | while read x ; do
      [ -z "$x" ] && break
      set - $x
      if [ $1 -gt 1 ]; then
        gids=$(gawk -F: '($1 == n) { print $3 }' n=$2 /etc/group | xargs)
        echo "Duplicate Group Name ($2): $gids"
      fi
    done
    
  3. Review the output to identify duplicate group names and their associated GIDs.
  4. For each duplicate group name, assign a unique name using the groupmod command.

    groupmod -n <new_group_name> <old_group_name>
    
  5. Verify that the group name has been updated correctly by checking the /etc/group file.
  6. Ensure that applications and services depending on the group are updated if necessary.
  7. Re-run the audit script to confirm that no duplicate group names exist.
  8. Implement regular audits and avoid manual edits to /etc/group to prevent future issues.