Use it to read local account details, or when an account's home or shell is wrong.
/etc/passwd
/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.
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.
login → name looked up in passwd (or directory) → UID, GID, home and shell taken → password checked in shadow
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
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
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 · 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.
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.
pwck -r— check passwd/shadow consistencyid <user>— UID, primary group and groupsgetent passwd <user>— account entry (local or directory)getent group <group>— group memberssudo -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):
| Field | Content | Notes |
|---|---|---|
| 1 name | Login name | Should not contain capital letters |
| 2 password | x, * or (historically) a hash | x means the hash is in /etc/shadow |
| 3 UID | Numeric user ID | 0 is root |
| 4 GID | Primary group ID | Other groups are in /etc/group |
| 5 GECOS | Comment, usually the full name | Optional |
| 6 directory | Home directory | Sets $HOME |
| 7 shell | Program run at login | Empty means /bin/sh |
Password field values (manual)
| Value | Meaning |
|---|---|
x | Shadow passwords are used |
* | Password login disabled; cron, mail and similar still work |
| Empty | Login without a password, unless applications prevent it |
Locking an account
| Method | Effect |
|---|---|
usermod -L / passwd -l | Prefixes the hash in /etc/shadow with !; password login is blocked |
Shell /usr/sbin/nologin | No 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.
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.
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
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
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%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.
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.
Quick lookup tables
/etc/passwd operational reference
Topic-specific lookup boundaries, proof limits and next-step Evidence for /etc/passwd.
| Lookup boundary | Topic-specific reference | Operational 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 verification | Pin 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 access | Trace requested/configured state through effective state to the observed workload result. |
| Failure boundary | A 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 evidence | Correlated 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 access | Use this observation only for the specific claim it actually supports. |
| Evidence limit | It 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 check | Continue 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 path | Users & 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 boundary | A 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 rule | Prove which configuration source owns the state, then prove that the running consumer loaded or generated the intended state. |