Pcornel
Browse topics
Options
Recent
Favorites
Linux · Technical reference

/etc/passwd

Direct answer

/etc/passwd lists local accounts, one per line: name:x:UID:GID:comment:home:shell. The x means the password hash is in /etc/shadow. The file is world-readable.

When to use this

Use it to read local account details, or when an account's home or shell is wrong.

First 30 seconds

1. getent passwd <user> — fields as expected?

2. Wrong shell → usermod -s /bin/bash <user>.

3. Wrong home → usermod -d /home/<user> -m <user>.

4. Check consistency: pwck -r.

5. Test login.

Operational verification

login → name looked up in passwd (or directory) → UID, GID, home and shell taken → password checked in shadow

Evidence · next step

For Users & Groups → /etc/passwd, continue with the first unproven Topic check: Validate field count and numeric UID/GID values for the target record. If that boundary is healthy, advance to the adjacent check: Resolve the account through the effective NSS stack, not only by grepping the file. 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
Scope / prerequisiteUse it to read local account details, or when an account's home or shell is wrong.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

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

5 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

/etc/passwd record → NSS source order → resolved account/UID/GID → referenced home/shell/group → session/process credentials → target access

Healthy evidence: the local record is structurally valid, resolves as intended through NSS and its numeric identity matches the process/workload context.

Step 2 Verification and output interpretation Verify boundary

Existing fast checks for this Topic. - Validate field count and numeric UID/GID values for the target record.

  • Resolve the account through the effective NSS stack, not only by grepping the file.
  • Check referenced primary group, home directory and shell separately.
  • Correlate with the actual session/process UID before drawing an access conclusion.

Verification chain. /etc/passwd record → NSS source order → resolved account/UID/GID → referenced home/shell/group → session/process credentials → target access

Step 3 Commands Verify boundary
getent passwd alice
awk -F: '$3>=1000' /etc/passwd
Step 4 Failure modes and next checks Narrow the fault

Suspicious evidence: duplicate/conflicting IDs, an external identity source wins unexpectedly, or local file presence is mistaken for login/authentication success.

Step 5 Common mistakes Narrow the fault
  • Editing with a text editor (use vipw).
Evidence references

Evidence · 1 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 · 1
Key points

Edit with usermod or vipw, not a plain editor, to avoid corrupting it. Use getent passwd to include directory users. A shell of /usr/sbin/nologin or /bin/false prevents interactive login.

Key checks
  • pwck -r — check passwd/shadow 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
ReferenceWhat it is1 section · depth on demand

Core model

Parse the local record structure, then show whether the host identity resolver actually uses the entry and whether external sources override or supplement local data. Treat fields as configured metadata: the home path, shell and primary GID must be verified independently, and the password placeholder field does not describe the complete authentication path.

ReferenceImportant terms & boundaries5 sections · depth on demand

What this shows and what it does not

A syntactically valid passwd entry shows local configured metadata, not authoritative resolution, password authentication, session creation or target authorization.

In depth

/etc/passwd field by field

/etc/passwd is world-readable, so every program can map user names to UIDs. That's why password hashes no longer live there. The passwd(5) manual page describes each of the seven fields (name:password:UID:GID:GECOS:directory:shell):

FieldContentNotes
1 nameLogin nameShould not contain capital letters
2 passwordx, * or (historically) a hashx means the hash is in /etc/shadow
3 UIDNumeric user ID0 is root
4 GIDPrimary group IDOther groups are in /etc/group
5 GECOSComment, usually the full nameOptional
6 directoryHome directorySets $HOME
7 shellProgram run at loginEmpty means /bin/sh

Password field values (manual)

ValueMeaning
xShadow passwords are used
*Password login disabled; cron, mail and similar still work
EmptyLogin without a password, unless applications prevent it

Locking an account

MethodEffect
usermod -L / passwd -lPrefixes the hash in /etc/shadow with !; password login is blocked
Shell /usr/sbin/nologinNo interactive login; the manual notes su can still work
usermod -e 1 (expire)The account is expired for all PAM-based logins, including SSH keys

Locking only the password doesn't stop SSH key logins. To disable an account completely, expire it or set the shell to nologin as well.

Editing safely

Use vipw (and vipw -s for shadow) instead of a plain editor. It locks the files and checks the result. Even better, use usermod and chsh, which change one field without touching the rest.

host$ getent passwd alice | tr ':' '\n' | nl
     1  alice
     2  x
     3  1003
     4  1003
     5  Alice Example
     6  /home/alice
     7  /bin/bash
host$ awk -F: '$3 == 0 {print $1}' /etc/passwd
root
host$ awk -F: '$2 != "x" {print $1}' /etc/passwd
host$ sudo pwck -r
host$ sudo chsh -s /usr/sbin/nologin bob

Quick checks

The first awk lists every account with UID 0, which should only ever be root. The second lists accounts whose password field isn't x. Both are worth including in a regular security check, together with pwck -r for consistency.

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

/etc/passwd is part of Users & Groups → /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.

Topic-specific state model. /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.

Interpretation rule. - Entry in /etc/passwd ≠ only or authoritative identity source on the host.

  • Password field placeholder ≠ password hash or evidence of authentication state.
  • Home/shell field ≠ resource existence or successful login.
  • Textual name ≠ kernel credential until resolved to numeric UID/GID and attached to a process.

Quick reference

/etc/passwd fields (colon-separated): name:x:UID:GID:GECOS:home:shell. The x means the password hash is in /etc/shadow.

alice:x:1001:1001:Alice Jensen:/home/alice:/bin/bash
app:x:995:993::/var/lib/app:/usr/sbin/nologin

Documented example, not captured output.

getent passwd alice
awk -F: '$3 == 0' /etc/passwd             # UID 0 accounts
awk -F: '$7 !~ /nologin|false/' /etc/passwd   # accounts with login shells
pwck -r

Edit with useradd/usermod or vipw (locks the file) rather than a plain editor.

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

Limits and how it fails

Primary failure point. A syntactically valid passwd entry shows local configured metadata, not authoritative resolution, password authentication, session creation or target authorization.

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.

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 → /etc/passwd. 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.

Related reference impactReview these references after material technical changes when their shared boundary is affected.
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
etc passwdpasswd file linuxlinux account databasepasswd fields
Embedded reference data

Quick lookup tables

/etc/passwd operational reference

Topic-specific lookup boundaries, proof limits and next-step Evidence for /etc/passwd.

Lookup boundaryTopic-specific referenceOperational use
Scope / effective state/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.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 chain/etc/passwd record → NSS source order → resolved account/UID/GID → referenced home/shell/group → session/process credentials → target accessTrace requested/configured state through effective state to the observed workload result.
Failure boundaryA syntactically valid passwd entry proves local configured metadata, not authoritative resolution, password authentication, session creation or target authorization.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: /etc/passwd record → NSS source order → resolved account/UID/GID → referenced home/shell/group → session/process credentials → target accessUse 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. A syntactically valid passwd entry proves local configured metadata, not authoritative resolution, password authentication, session creation or target authorization.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.

/etc/passwd · operational reference

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

Reference boundary/etc/passwd
Topic pathUsers & Groups → /etc/passwd
Runtime state/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.
Fast checks- Validate field count and numeric UID/GID values for the target record. - Resolve the account through the effective NSS stack, not only by grepping the file. - Check referenced primary group, home directory and shell separately. - Correlate with the actual session/process UID before drawing an access conclusion.
Verification chain/etc/passwd record → NSS source order → resolved account/UID/GID → referenced home/shell/group → session/process credentials → target access Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary. Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return path or regression → explicit Evidence boundary.
Failure boundaryA syntactically valid passwd entry proves local configured metadata, not authoritative resolution, password authentication, session creation or target authorization. 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?