List a user's group memberships with groups
Check which groups grant a user their sudo, docker, or file permissions — the first diagnostic for 'permission denied'.
Run `groups alice` (or bare `groups` for yourself) to print every group the account belongs to.
01Command
Command
$ groups alice02What it does
Most file and capability access on Linux is granted through group membership — wheel/sudo for root, docker for the daemon socket, www-data for web trees. `groups user` resolves those memberships through NSS, so it also works for domain users. Two gotchas: memberships added with usermod only apply to new login sessions, so `newgrp docker` or re-login is needed, and the comma-joined member list shown by `getent group docker` omits members whose primary group it is.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- groups(1) — print group memberships a user is inEvidence: Documents groups printing the group names for a specified user, defaulting to the current user.
Last verified: 2026-09-17 · Category: Security & Privacy