Pcornel
Browse topics
Options
Recent
Favorites
Linux · Technical reference

/etc/shadow

Direct answer

/etc/shadow stores password hashes and ageing data: name:hash:last change:min:max:warn:inactive:expire. Only root can read it.

When to use this

Use it to check whether an account is locked, expired or uses a weak hash.

First 30 seconds

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.

Operational verification

login → hash in shadow checked → ageing and expiry checked → access granted or refused

Evidence · next step

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
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 check whether an account is locked, expired or uses a weak hash.
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

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 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

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.

Key checks
  • passwd -S <user> — password status
  • 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

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:

FieldContent
1Login name
2Password hash (crypt(3) format), or a lock marker
3Date of last change, in days since 1970-01-01 (0 = must change at next login)
4Minimum age in days before another change
5Maximum age in days (empty = no limit)
6Warning period in days before expiry
7Inactivity period: days after expiry during which the old password still works
8Account expiry date, in days since 1970-01-01
9Reserved

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

PrefixAlgorithm
$y$yescrypt (default on recent Debian, Ubuntu and Fedora)
$6$SHA-512 crypt
$5$SHA-256 crypt
$1$MD5 crypt (obsolete)

Working with ageing

TaskCommand
Show ageing for a userchage -l alice
Force a change at next loginchage -d 0 alice
Maximum 90 days, warn 14 days aheadchage -M 90 -W 14 alice
Account expirychage -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.

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/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 prefixAlgorithm
$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
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. 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
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/shadow. 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 shadowshadow password filelinux password aginglinux locked password
Embedded reference data

Quick lookup tables

/etc/shadow operational reference

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

Lookup boundaryTopic-specific referenceOperational 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 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 chainaccount resolution → /etc/shadow hash/lock/aging state → PAM/service auth policy → credential method → session creation → process identity → workload resultTrace requested/configured state through effective state to the observed workload result.
Failure boundaryShadow 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 evidenceCorrelated 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 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. 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 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/shadow · operational reference

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

Reference boundary/etc/shadow
Topic pathUsers & 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 chainaccount 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 boundaryShadow 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 ruleProve which configuration source owns the state, then prove that the running consumer loaded or generated the intended state.
Confirmation

Confirm action

Continue?