Pcornel
Linux · Users & Groups

/etc/group

Cheat sheet · https://pcornel.dk/topic.php?topic=2703

Back to the Topic

Answer

/etc/group lists local groups: name:x:GID:members. Supplementary members are listed there; a user's primary group comes from /etc/passwd.

Remember

Edit with groupadd, gpasswd -a/-d or usermod -aG, or vigr — not a plain editor. A user's primary group is not listed in the members field.

First checks

  • grpck -r — check group file consistency
  • id <user> — UID, primary group and groups
  • getent passwd <user> — account entry (local or directory)
  • getent group <group> — group members
  • sudo -l -U <user> — what the user may run with sudo

Commands

getent group alice
id -nG <user>
sudo
docker

Verify in this order

group defined with a GID → members listed → loaded at login → used in permission checks

Where it usually breaks

First mismatch in identity/group resolution → Unix mode/ACL/capability → mount/sandbox constraint → SELinux/AppArmor policy → credential/TLS trust → protected operation; preserve identity/native diagnostic/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2703

Confirmation

Confirm action

Continue?