Pcornel
Browse topics
Options
Recent
Favorites
Linux · Technical reference

Users & Groups

Direct answer

Users and groups map names to numeric UIDs and GIDs that the kernel uses for every permission check. Accounts come from /etc/passwd, /etc/group and /etc/shadow, or from a directory service via SSSD/winbind.

When to use this

Use it as the entry point for account, group membership and login problems.

First 30 seconds

1. getent passwd <user> — account exists, shell and home?

2. id <user> — groups as intended (new login after changes)?

3. Locked/expired? passwd -S, chage -l.

4. Admin rights? sudo -l -U <user>.

5. Test as the user: sudo -u <user> <cmd>.

Operational verification

name → passwd/directory lookup → UID/GID and groups → kernel permission checks → sudo rules

Evidence · next step

For Users & Groups, continue with the first unproven Topic check: Identify the exact user/service process and capture real/effective/saved UID/GID plus supplementary groups. If that boundary is healthy, advance to the adjacent check: Resolve the same names through the host identity stack and note whether data is local or external. Preserve the same host/time/identity scope and rerun the original workload before accepting recovery.

Continue only after interpreting the current observation.
Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
linux
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

Platformlinux
Key commanduseradd
Scope / prerequisiteUse it as the entry point for account, group membership and login problems.
Reference · 7
What next?3 suggested next steps
Child topics (this level)8
Catalog command links7
Evidence2
On this pageJump to a specific section
Linux command reference

Primary Commands

Configuration and operational commands for this Topic.

useraddReference
useradd

Create a local user account and its account-database attributes.

Use when: Primary lookup intent: configure. Use useradd when the lookup goal is to create a local user account and its account-database attributes. Tie the result to the same host, namespace, user identity and time window as the symptom.

Quick note: Post-change verification for useradd: Verify NSS identity, group membership, home ownership and controlled login/service behavior. Output review: healthy and suspicious cues are command-specific interpretation boundaries, not fixed literal output samples. Intent class: configure. Safety class: changes_state. Intent describes the primary lookup role; safety remains command-family capability and can be higher than a read-only invocation. useradd is documented as an operational lookup primitive under Users & Groups. The canonical leaf intentionally represents the command family; options remain distribution/tool-version specific.

Linux · state
usermodReference
usermod

Modify an existing local user account, groups, identifiers or login properties.

Use when: Primary lookup intent: configure. Use usermod when the lookup goal is to modify an existing local user account, groups, identifiers or login properties. Tie the result to the same host, namespace, user identity and time window as the symptom.

Quick note: Post-change verification for usermod: Verify NSS/account state, ownership and controlled authentication/service behavior. Output review: healthy and suspicious cues are command-specific interpretation boundaries, not fixed literal output samples. Intent class: configure. Safety class: changes_state. Intent describes the primary lookup role; safety remains command-family capability and can be higher than a read-only invocation. usermod is documented as an operational lookup primitive under Users & Groups. The canonical leaf intentionally represents the command family; options remain distribution/tool-version specific.

Linux · state
userdelReference
userdel

Remove a local user account and optionally its home or mail data.

Use when: Primary lookup intent: destructive. Use userdel when the lookup goal is to remove a local user account and optionally its home or mail data. Tie the result to the same host, namespace, user identity and time window as the symptom.

Quick note: Post-change verification for userdel: Verify NSS identity, ownership/memberships and controlled authentication/workload behavior. Output review: healthy and suspicious cues are command-specific interpretation boundaries, not fixed literal output samples. Intent class: destructive. Safety class: destructive. Intent describes the primary lookup role; safety remains command-family capability and can be higher than a read-only invocation. userdel is documented as an operational lookup primitive under Users & Groups. The canonical leaf intentionally represents the command family; options remain distribution/tool-version specific.

Linux · state
groupaddReference
groupadd

Create a local group entry with an assigned or automatic group identifier.

Use when: Primary lookup intent: configure. Use groupadd when the lookup goal is to create a local group entry with an assigned or automatic group identifier. Tie the result to the same host, namespace, user identity and time window as the symptom.

Quick note: Post-change verification for groupadd: Verify NSS/group membership and test access with the intended users/services. Output review: healthy and suspicious cues are command-specific interpretation boundaries, not fixed literal output samples. Intent class: configure. Safety class: changes_state. Intent describes the primary lookup role; safety remains command-family capability and can be higher than a read-only invocation. groupadd is documented as an operational lookup primitive under Users & Groups. The canonical leaf intentionally represents the command family; options remain distribution/tool-version specific.

Linux · state
passwdReference
passwd

Change password credentials or password-aging and account-lock state.

Use when: Primary lookup intent: configure. Use passwd when the lookup goal is to change password credentials or password-aging and account-lock state. Tie the result to the same host, namespace, user identity and time window as the symptom.

Quick note: Post-change verification for passwd: Verify account state and perform a controlled authentication test through the intended login path. Output review: healthy and suspicious cues are command-specific interpretation boundaries, not fixed literal output samples. Intent class: configure. Safety class: changes_state. Intent describes the primary lookup role; safety remains command-family capability and can be higher than a read-only invocation. passwd is documented as an operational lookup primitive under Users & Groups. The canonical leaf intentionally represents the command family; options remain distribution/tool-version specific.

Linux · state
suReference
su

Start a shell or command under another user identity after authentication or policy checks.

Use when: Primary lookup intent: configure. Use su when the lookup goal is to start a shell or command under another user identity after authentication or policy checks. Tie the result to the same host, namespace, user identity and time window as the symptom.

Quick note: Output review: healthy and suspicious cues are command-specific interpretation boundaries, not fixed literal output samples. Intent class: configure. Safety class: low_impact. Intent describes the primary lookup role; safety remains command-family capability and can be higher than a read-only invocation. su is documented as an operational lookup primitive under Users & Groups. The canonical leaf intentionally represents the command family; options remain distribution/tool-version specific.

Linux · state
sudoReference
sudo

Run an allowed command as another identity according to sudo policy and authentication state.

Use when: Primary lookup intent: configure. Use sudo when the lookup goal is to run an allowed command as another identity according to sudo policy and authentication state. Tie the result to the same host, namespace, user identity and time window as the symptom.

Quick note: Post-change verification for sudo: Verify target state independently and rerun the workload under the intended effective identity. Output review: healthy and suspicious cues are command-specific interpretation boundaries, not fixed literal output samples. Intent class: configure. Safety class: changes_state. Intent describes the primary lookup role; safety remains command-family capability and can be higher than a read-only invocation. sudo is documented as an operational lookup primitive under Security. The canonical leaf intentionally represents the command family; options remain distribution/tool-version specific.

Linux · mixed
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

7 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Operational evidence path Verify boundary

identity source/NSS → username/group resolution → UID/GID + supplementary groups → session/process credentials → sudo/su transition if any → object ownership + mode/ACL → kernel access decision → workload result

Healthy evidence: name resolution, numeric IDs, supplementary groups, process credentials and target ownership all agree with the intended principal and the original operation succeeds under the expected policy.

Step 2 Operational verification Verify boundary

Users/groups, ownership, mode bits, ACLs and sudo authorization on Linux.

Fast verification

  • Confirm identity and group membership with id/getent.

- Check owner, mode bits and ACLs (ls -l, namei -l, getfacl) across the full path.

- Use sudo -l for authorization; successful login does not imply sudo permission.

Step 3 Commands Verify boundary
id alice
getent passwd alice
getent group wheel
sudo -l -U alice
Step 4 Verification and output interpretation Verify boundary

Verification path. Verify numeric identity and the exact credentials of the failing process, not only the account database. Inspect ownership/mode/ACL information on every relevant path component and validate sudo policy using the invoking identity and command context. For session changes, show whether the process predates the group/policy update. A controlled access test under the same user, groups, cwd and environment is stronger than reading policy files in isolation.

Existing fast checks for this Topic. - Identify the exact user/service process and capture real/effective/saved UID/GID plus supplementary groups.

  • Resolve the same names through the host identity stack and note whether data is local or external.
  • Compare process credentials with target object owner/group, mode, ACL and any privilege transition.
  • Repeat the original read/write/execute/service operation with the same effective identity.

Verification chain. identity source/NSS → username/group resolution → UID/GID + supplementary groups → session/process credentials → sudo/su transition if any → object ownership + mode/ACL → kernel access decision → workload result

Step 5 Common mistakes Narrow the fault
  • Editing /etc/passwd by hand instead of useradd/usermod.
  • Adding users to groups without -a (usermod -G replaces groups).
Step 6 Failure modes and next checks Narrow the fault

Suspicious evidence: a username is treated as evidence of UID, a recently changed group is assumed active in an old session, or login/sudo success is substituted for target authorization.

It does not show behavior outside the captured identity source, process credential, filesystem object, DAC/ACL, privilege or workload scope. Identity evidence establishes who the process is within the captured host/session context; it does not by itself show authorization, LSM policy, mount restrictions, service policy or successful workload behavior.

Next check: Continue from the first step that has not been verified: keep the same process/session, resolve numeric identity and groups, inspect each path component plus target ownership/mode/ACL/special bits, capture any privilege transition/non-DAC denial, then repeat the original operation before broadening permissions.

Step 7 Where it fails Narrow the fault

Walk identity/group resolution → Unix mode/ACL/capability → mount/sandbox constraint → SELinux/AppArmor policy → credential/TLS trust → protected operation and stop where observed state diverges.

Evidence references

Evidence · 2 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1command output · 1
Drill down

Subtopics

Go one level deeper into this subject.

Subtopic Users

Users are Linux account identities represented by numeric UIDs plus account metadata such as name, primary GID, home directory and login shell; interactive humans, service accounts and system accounts can share the same underlying credential model while serving different operational purposes.

Subtopic Groups

Groups aggregate Linux identities under numeric GIDs so discretionary access and application policy can be delegated to sets of users; a process can carry one primary GID and multiple supplementary GIDs initialized from the identity stack.

Subtopic UID / GID

UID and GID are the numeric Linux identity values consumed by the kernel for users and groups; names are resolved presentation and administration labels layered on top of those numeric credentials.

Subtopic root

root is conventionally UID 0 and is the traditional Linux superuser identity, but effective privilege depends on the execution namespace, Linux capabilities, LSM policy, mount/filesystem constraints and application-level controls rather than the account name alone.

Subtopic /etc/passwd

/etc/passwd is the traditional local account database containing colon-delimited account metadata such as login name, UID, primary GID, GECOS, home and login shell; modern password hashes are normally stored elsewhere, and NSS may combine this file with other identity sources.

Subtopic /etc/shadow

/etc/shadow stores protected local password-hash and password-aging metadata for shadow-enabled Linux accounts; its fields can encode hash state, lock markers and aging dates, but actual authentication behavior also depends on PAM, NSS and the selected login service.

Subtopic /etc/group

/etc/group is the traditional local group database containing group name, numeric GID and explicit member list; the user primary group is usually derived from the passwd record and may not appear in the group member field.

Subtopic sudoers

sudoers is the policy model used by sudo to decide which invoking principals may run which commands as which target users/groups under defined host, authentication, environment and option constraints; policy authorization is distinct from the executed command result.

Key points

The kernel checks numbers, not names. New group membership applies only to new logins. Use getent to see both local and directory accounts. Grant admin rights through sudoers groups.

Key checks
  • id <user> — UID, GID and groups
  • getent passwd <user> — account entry
  • getent group <group> — group members
  • sudo -l -U <user> — sudo rights
ReferenceWhat it is3 sections · depth on demand

Operational scope

Users/groups, ownership, mode bits, ACLs and sudo authorization on Linux.

What it is

Users/groups, ownership, mode bits, ACLs and sudo authorization on Linux.

Core model

Resolve the authoritative account and group sources first, then show the numeric identity actually attached to the process. Separate stored account metadata from NSS resolution, login/session establishment, supplementary-group initialization and later sudo/su transitions. Filesystem access decisions consume numeric credentials; a familiar username alone is not the security boundary.

ReferenceWhy it matters2 sections · depth on demand

When to use it

Use Users, Permissions & sudo when the problem concerns Linux runtime, services, networking, identity, packages, storage or shell automation.

Why it matters operationally

The useful outcome is not simply knowing a definition; it is being able to decide whether Users, Permissions & sudo is healthy, misconfigured, missing, or only a symptom of a failure somewhere else.

ReferenceHow it works1 section · depth on demand

How it works

Users/groups, ownership, mode bits, ACLs and sudo authorization on Linux.

ReferenceImportant terms & boundaries4 sections · depth on demand

What this shows and what it does not

Identity evidence establishes who the process is within the captured host/session context; it does not by itself show authorization, LSM policy, mount restrictions, service policy or successful workload behavior.

In depth

Creating and managing accounts

Accounts are created with useradd (or a distribution wrapper such as adduser), and the defaults come from two files. The useradd(8) manual page describes them:

  • /etc/login.defs sets the UID ranges: UID_MIN (default 1000) and UID_MAX (default 60000) for regular users, and SYS_UID_MIN and SYS_UID_MAX for system accounts. Its USERGROUPS_ENAB setting decides whether each user gets a private group with the same name.
  • /etc/default/useradd sets the home base directory, shell and skeleton directory.

-m creates the home directory and copies /etc/skel into it. -r creates a system account in the system UID range, without a home directory unless -m is given.

useradd options (manual)

OptionPurpose
-mCreate the home directory from /etc/skel
-s <shell>Login shell
-g <group>Primary group (must exist)
-G g1,g2Supplementary groups (comma-separated, no spaces)
-u <uid>Specific UID
-rSystem account
-c "text"Comment (full name)
-e YYYY-MM-DDExpiry date

Day-to-day account tasks

TaskCommand
Add to a group, keeping existing groupsusermod -aG docker alice
Lock / unlock the passwordusermod -L alice / usermod -U alice
Expire the accountusermod -e 2026-12-31 alice (or chage -E)
Password ageingchage -l alice, chage -M 90 alice
Remove the user and the home directoryuserdel -r alice
host$ sudo useradd -m -s /bin/bash -c "Alice Example" -G ssh-users,adm alice
host$ id alice
uid=1003(alice) gid=1003(alice) groups=1003(alice),4(adm),1010(ssh-users)
host$ sudo useradd -r -s /usr/sbin/nologin -d /var/lib/reportapi reportapi
host$ getent passwd reportapi
reportapi:x:998:998::/var/lib/reportapi:/usr/sbin/nologin
host$ grep -E "^(UID_MIN|UID_MAX|SYS_UID_MIN|USERGROUPS_ENAB)" /etc/login.defs
host$ sudo usermod -aG docker alice
host$ sudo chage -l alice | head -4

The -a in usermod -aG

usermod -G without -a replaces the supplementary group list. It silently removes the user from every group not named, which can lock an administrator out of sudo. Always use -aG to add a group.

Exit codes

useradd's exit codes make scripting reliable. 9 means the name is already in use, 4 that the UID is taken, and 6 that a named group doesn't exist.

Documented example, not captured output.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

How it works at runtime

Users & Groups is part of Users & Groups. Users & Groups is the Linux identity foundation for mapping human or service account names to numeric UID/GID values, supplementary groups and process credentials before discretionary access control or privilege transitions are evaluated.

Runtime state ownership and mechanics. Linux authorization combines numeric UID/GID identity, supplementary groups, discretionary mode bits, ACLs, capabilities, sudo/PAM policy and optional LSM enforcement. Name-service databases map names to numeric identities, but the kernel authorizes using numeric credentials attached to the process. Effective, real and saved IDs can differ, and group membership is normally established when the session is created rather than re-read for every filesystem operation.

Topic-specific state model. Users & Groups is the Linux identity foundation for mapping human or service account names to numeric UID/GID values, supplementary groups and process credentials before discretionary access control or privilege transitions are evaluated.

Technical metadata. Host/container/user-namespace identity, process PID/session/service, identity source/NSS result, username/group names, numeric UID/GID, real/effective/saved/fs credentials where relevant, supplementary groups, sudo invoking/target identity and matched policy, pathname + parent traversal, filesystem/inode, numeric owner/group, object type, octal/symbolic mode, SUID/SGID/sticky bits, access/default ACL entries and mask, mount flags and relevant non-DAC control, requested operation and original workload result.

Interpretation rule. - Username ≠ UID; the kernel primarily evaluates numeric credentials.

  • Account exists in a source ≠ current process has that identity or refreshed group membership.
  • Primary group ≠ complete supplementary-group set.
  • Successful login or sudo ≠ permission to every target object or service.

Limits and how it fails

Primary failure point. Identity evidence establishes who the process is within the captured host/session context; it does not by itself show authorization, LSM policy, mount restrictions, service policy or successful workload behavior.

Model. A username is a mapping, while kernel authorization uses numeric credentials. Mode 0777 does not bypass SELinux/AppArmor, mount flags or application policy. Membership listed in /etc/group does not show an existing process has that supplementary group. sudo authorization is not the same as shell root login, and root can still be constrained by namespaces, read-only mounts, immutable attributes or LSM rules. Keep authentication, identity and authorization separate.

ReferenceConfiguration & state1 section · depth on demand

Configuration, persistence and lifecycle

Configuration intent and lifecycle. Treat /etc/passwd, /etc/shadow, /etc/group and sudoers as policy databases with strict syntax, ownership and permission requirements, while remembering that NSS can source identities elsewhere. User/group changes may require a new login/session before supplementary credentials change. Permission changes should preserve least privilege and account for ACL masks, setuid/setgid semantics, sticky directories, file capabilities and LSM labels where applicable.

Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor doclinux current

Authoritative/upstream documentation reviewed for bounded claims in Users & Groups. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://www.kernel.org/doc/man-pages/ · confidence 94%
Technical changelog & impact

What changed and what may be affected

Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.

Terminology layer

Terms & aliases

Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.

Aliases that resolve here
linux users and groupsusers, permissions & sudolinux account identitylinux users, permissions & sudouid gid groupsUsers, Permissions & sudo troubleshootinglinux user permissions identity
Embedded reference data

Quick lookup tables

Users & Groups operational reference

Topic-specific lookup boundaries, proof limits and next-step Evidence for Users & Groups.

Lookup boundaryTopic-specific referenceOperational use
Scope / effective stateUsers & Groups is the Linux identity foundation for mapping human or service account names to numeric UID/GID values, supplementary groups and process credentials before discretionary access control or privilege transitions are evaluated.Establish exactly what this Topic owns before crossing into another subsystem.
Fast verificationPin the exact process/session → resolve user/group names to numeric UID/GID through the effective identity stack → capture effective UID/GID + supplementary groups → resolve every required path component and target inode → inspect numeric owner/group + mode + ACL/mask + special bits → capture sudo/privilege transition if present → account for non-DAC controls → repeat the original workload operation.Use the shortest evidence path first; a fast check is a boundary test, not blanket proof.
Verification chainidentity source/NSS → username/group resolution → UID/GID + supplementary groups → session/process credentials → sudo/su transition if any → object ownership + mode/ACL → kernel access decision → workload resultTrace requested/configured state through effective state to the observed workload result.
Failure boundaryIdentity evidence establishes who the process is within the captured host/session context; it does not by itself prove authorization, LSM policy, mount restrictions, service policy or successful workload behavior.Stop broad troubleshooting at the first boundary that is not supported by evidence.
Positive evidenceCorrelated Linux identity and authorization evidence can establish this proof path: identity source/NSS → username/group resolution → UID/GID + supplementary groups → session/process credentials → sudo/su transition if any → object ownership + mode/ACL → kernel access decision → workload resultUse this observation only for the specific claim it actually supports.
Evidence limitIt does not independently prove behavior outside the captured identity source, process credential, filesystem object, DAC/ACL, privilege or workload scope. Identity evidence establishes who the process is within the captured host/session context; it does not by itself prove authorization, LSM policy, mount restrictions, service policy or successful workload behavior.Do not promote a local success signal into end-to-end or adjacent-dependency proof.
Next troubleshooting checkContinue from the first unproven boundary: keep the same process/session, resolve numeric identity and groups, inspect each path component plus target ownership/mode/ACL/special bits, capture any privilege transition/non-DAC denial, then repeat the original operation before broadening permissions.Continue to the next unresolved boundary while preserving the original test condition.

Users & Groups · operational reference

Compact Linux state, persistence, verification and boundary reference for fast lookup.

Reference boundaryUsers & Groups
Topic pathUsers & Groups
Runtime stateUsers & Groups is the Linux identity foundation for mapping human or service account names to numeric UID/GID values, supplementary groups and process credentials before discretionary access control or privilege transitions are evaluated.
Fast checks- Identify the exact user/service process and capture real/effective/saved UID/GID plus supplementary groups. - Resolve the same names through the host identity stack and note whether data is local or external. - Compare process credentials with target object owner/group, mode, ACL and any privilege transition. - Repeat the original read/write/execute/service operation with the same effective identity.
Verification chainidentity source/NSS → username/group resolution → UID/GID + supplementary groups → session/process credentials → sudo/su transition if any → object ownership + mode/ACL → kernel access decision → workload result Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary.
Failure boundaryIdentity evidence establishes who the process is within the captured host/session context; it does not by itself prove authorization, LSM policy, mount restrictions, service policy or successful workload behavior. Boundary chain: process/context → userspace configuration → kernel subsystem/resource → device/network/filesystem dependency → effective state → original workload.
Persistence ruleProve which configuration source owns the state, then prove that the running consumer loaded or generated the intended state.
Confirmation

Confirm action

Continue?