Use it to check whether an account is locked, expired or uses a weak hash.
/etc/shadow
/etc/shadow stores password hashes and ageing data: name:hash:last change:min:max:warn:inactive:expire. Only root can read it.
1. passwd -S <user> — P (usable), L (locked) or NP (no password)?
2. chage -l <user> — expired?
3. Unlock: passwd -u <user> / usermod -U <user>; extend: chage -E -1 <user>.
4. File permissions: ls -l /etc/shadow — root only (0640 root:shadow or 0000).
5. Test login.
login → hash in shadow checked → ageing and expiry checked → access granted or refused
For Users & Groups → /etc/shadow, continue with the first unproven Topic check: Confirm the exact account and interpret hash/lock/aging fields without exposing secret material unnecessarily. If that boundary is healthy, advance to the adjacent check: Correlate /etc/passwd and NSS resolution with the shadow entry. 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
account resolution → /etc/shadow hash/lock/aging state → PAM/service auth policy → credential method → session creation → process identity → workload result
Healthy evidence: shadow state is consistent with intended local password policy and the actual authentication service enforces it as expected.
Step 2 Verification and output interpretation Verify boundary
Existing fast checks for this Topic. - Confirm the exact account and interpret hash/lock/aging fields without exposing secret material unnecessarily.
- Correlate /etc/passwd and NSS resolution with the shadow entry.
- Identify the actual PAM/service authentication method used by the failing path.
- Test the intended login method after a controlled change instead of assuming file edit equals effective policy.
Verification chain. account resolution → /etc/shadow hash/lock/aging state → PAM/service auth policy → credential method → session creation → process identity → workload result
Step 3 Commands Verify boundary
sudo chage -l alice
sudo grep alice /etc/shadow
Step 4 Failure modes and next checks Narrow the fault
Suspicious evidence: a lock marker is assumed to disable every access method, aging is interpreted without service context, or sensitive hashes are copied into routine troubleshooting evidence.
Step 5 Common mistakes Narrow the fault
- Shadow file readable by non-root.
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.
A hash starting with ! or * means locked or no password login. Modern hashes start with $y$ (yescrypt) or $6$ (SHA-512). Change ageing with chage. Never copy hashes between systems in clear channels.
passwd -S <user>— password statusid <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
Read shadow state as one input to local password authentication. Distinguish usable hash, locked/disabled markers and aging policy from the account record and from the service authentication stack. A changed shadow entry is not evidence that every authentication path has accepted the new state or that key/token-based access is affected.
ReferenceImportant terms & boundaries5 sections · depth on demand
What this shows and what it does not
Shadow metadata shows local password/aging configuration, not all authentication methods, service enforcement or target authorization.
In depth
/etc/shadow and password ageing
Password hashes and ageing data are kept in /etc/shadow, which must not be readable by regular users. The shadow(5) manual page defines nine fields:
| Field | Content |
|---|---|
| 1 | Login name |
| 2 | Password hash (crypt(3) format), or a lock marker |
| 3 | Date of last change, in days since 1970-01-01 (0 = must change at next login) |
| 4 | Minimum age in days before another change |
| 5 | Maximum age in days (empty = no limit) |
| 6 | Warning period in days before expiry |
| 7 | Inactivity period: days after expiry during which the old password still works |
| 8 | Account expiry date, in days since 1970-01-01 |
| 9 | Reserved |
Lock markers (manual)
A leading ! means the password is locked, and the rest of the field keeps the old hash. A field such as * or ! on its own, which isn't valid crypt output, means the user can't log in with a password at all. Other methods, such as SSH keys, may still work.
Hash prefixes
| Prefix | Algorithm |
|---|---|
$y$ | yescrypt (default on recent Debian, Ubuntu and Fedora) |
$6$ | SHA-512 crypt |
$5$ | SHA-256 crypt |
$1$ | MD5 crypt (obsolete) |
Working with ageing
| Task | Command |
|---|---|
| Show ageing for a user | chage -l alice |
| Force a change at next login | chage -d 0 alice |
| Maximum 90 days, warn 14 days ahead | chage -M 90 -W 14 alice |
| Account expiry | chage -E 2026-12-31 alice |
host$ sudo getent shadow alice
alice:$y$j9T$Kx...:20412:0:99999:7:::
host$ date -d "1970-01-01 +20412 days" +%F
2025-11-19
host$ sudo chage -l alice
Last password change : Nov 19, 2025
Password expires : never
Account expires : never
host$ sudo chage -d 0 alice
host$ ls -l /etc/shadow
-rw-r----- 1 root shadow 1342 Nov 28 10:02 /etc/shadow
host$ sudo awk -F: '$2 == "" {print $1}' /etc/shadow
Reading the example
Field 3 (20412) converts to 19 November 2025 with date. Maximum age 99999 means the password never expires. The last command lists accounts with an empty password field, which allows login without a password. That should return nothing.
Documented example, not captured output.
How it works at runtime
/etc/shadow is part of Users & Groups → /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.
Topic-specific state model. /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.
Interpretation rule. - Shadow entry ≠ complete authentication policy.
- Locked password hash ≠ necessarily disabled account for SSH keys, tokens or other methods.
- Password expiry metadata ≠ immediate denial in every service without PAM/service enforcement.
- Readable shadow data ≠ safe handling; exposure is itself sensitive evidence.
Quick reference
/etc/shadow stores password hashes and ageing: name:hash:lastchg:min:max:warn:inactive:expire:.
| Hash prefix | Algorithm |
|---|---|
$y$ | yescrypt (Debian 11+, Ubuntu 22.04+, Fedora, RHEL 9+ optional) |
$6$ | SHA-512 crypt |
$5$ | SHA-256 crypt |
$1$ | MD5 (weak — rehash) |
! or * | Locked / no password |
ls -l /etc/shadow # 000 or 640 root:shadow
chage -l alice
awk -F: '$2 == "" {print $1}' /etc/shadow # empty passwords
Limits and how it fails
Primary failure point. Shadow metadata shows local password/aging configuration, not all authentication methods, service enforcement 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/shadow. 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/shadow operational reference
Topic-specific lookup boundaries, proof limits and next-step Evidence for /etc/shadow.
| Lookup boundary | Topic-specific reference | Operational use |
|---|---|---|
| Scope / effective state | /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. | 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 | account resolution → /etc/shadow hash/lock/aging state → PAM/service auth policy → credential method → session creation → process identity → workload result | Trace requested/configured state through effective state to the observed workload result. |
| Failure boundary | Shadow metadata proves local password/aging configuration, not all authentication methods, service enforcement 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: account resolution → /etc/shadow hash/lock/aging state → PAM/service auth policy → credential method → session creation → process identity → workload result | 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. Shadow metadata proves local password/aging configuration, not all authentication methods, service enforcement 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/shadow · operational reference
Compact Linux state, persistence, verification and boundary reference for fast lookup.
| Reference boundary | /etc/shadow |
|---|---|
| Topic path | Users & Groups → /etc/shadow |
| Runtime state | /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. |
| Fast checks | - Confirm the exact account and interpret hash/lock/aging fields without exposing secret material unnecessarily. - Correlate /etc/passwd and NSS resolution with the shadow entry. - Identify the actual PAM/service authentication method used by the failing path. - Test the intended login method after a controlled change instead of assuming file edit equals effective policy. |
| Verification chain | account resolution → /etc/shadow hash/lock/aging state → PAM/service auth policy → credential method → session creation → process identity → workload result 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 | Shadow metadata proves local password/aging configuration, not all authentication methods, service enforcement 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. |