October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk5 min

Linux Account Files Explained: Every Field in /etc/passwd and /etc/shadow

A practical guide to all seven /etc/passwd fields and nine /etc/shadow fields, with clear explanations of password markers and expiration rules.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

/etc/passwd describes local user accounts in seven colon-separated fields; /etc/shadow holds password-verifier and password-aging data in nine. The key distinction: a marker such as ! blocks Unix-password authentication, but does not by itself prove that every login route is disabled. These formats describe local account files; actual login behavior also depends on the system’s authentication configuration.

What is the difference between /etc/passwd and /etc/shadow?

/etc/passwd maps account names to details such as numeric user and group IDs, home directories, and shells. Programs commonly need to read those details, so the file is generally readable by all users and writable only by the superuser. On a shadow-password setup, its password field usually contains x, indicating that the password verifier is kept in the corresponding /etc/shadow record.

As an Amazon Associate I earn from qualifying purchases.

/etc/shadow contains the password field and password-aging controls. The Linux shadow(5) manual says: “This file must not be readable by regular users if password security is to be maintained.” See the Linux passwd(5) manual and the shadow-utils shadow(5) manual for the documented formats.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What do the seven fields in /etc/passwd mean?

A local account record has this form:

name:password:UID:GID:GECOS:directory:shell

  1. Login name: The account name used to identify the record.
  2. Password field: Commonly x when the verifier is stored in /etc/shadow. An empty field may permit passwordless login, although some applications refuse access when it is blank. A leading ! locks the password. Values that are not valid crypt(3) results, such as ! or *, prevent Unix-password login, but do not necessarily block other login methods.
  3. UID: The numeric user ID. UID 0 is the privileged root identity.
  4. GID: The numeric primary group ID. Additional group memberships are recorded elsewhere in the group database.
  5. GECOS/comment: Informational text, often a person’s name, which tools may display. Utilities that use this field may expand an ampersand to the capitalized login name.
  6. Home directory: The initial working directory; the login process uses it to set HOME.
  7. Command interpreter: The login shell or initial program; login uses it to set SHELL. The cited manual says an empty field defaults to /bin/sh.

What do the nine fields in /etc/shadow mean?

A shadow record has this form:

login:password:last-change:min:max:warning:inactive:expire:reserved

  1. Login name: Identifies the account and should correspond to an account on the system.
  2. Password field: An empty value may allow passwordless login, depending on application behavior. A leading ! marks the password as locked; any remaining characters preserve the value that was present before locking. A value that is not a valid crypt(3) result, such as ! or *, prevents Unix-password login, though other login methods may still be available.
  3. Last password change: Days since 1970-01-01 00:00:00 UTC. A value of 0 requires a password change at the next login. An empty field disables password-aging features.
  4. Minimum password age: Days that must pass before the password can be changed. Empty or 0 means there is no minimum wait.
  5. Maximum password age: Days after which a password change is required. When that time elapses, the password may still be accepted and the user is prompted to change it at the next login. An empty field means there is no maximum age, warning period, or inactivity period. If the maximum age is less than the minimum age, the user cannot change the password.
  6. Warning period: Days before password expiration during which the user is warned. Empty or 0 means no warning period.
  7. Inactivity period: Days after password expiration during which the password remains accepted and the user must update it at the next login. After this period elapses, the user cannot log in and must contact an administrator. An empty field means no inactivity period is enforced.
  8. Account expiration date: Days since 1970-01-01. This controls account expiration, not password age. An empty field means the account never expires. The manual cautions against using 0, because it may be interpreted either as no expiration or as 1970-01-01.
  9. Reserved field: Reserved for future use.

What do x, !, *, and a blank password field mean?

  • x in /etc/passwd: Commonly means that the password verifier is stored in the matching /etc/shadow record.
  • ! at the start of a password field: Marks the Unix password as locked. In /etc/shadow, characters after the marker preserve the prior value.
  • * or another non-crypt(3) value: Prevents authentication with a Unix password. It does not establish that all possible access methods are blocked.
  • Blank password field: Do not assume this means “disabled.” The manuals describe an empty field as potentially permitting passwordless authentication, while noting that applications may reject it.

These markers concern Unix-password authentication, not necessarily every authentication method configured on a host. PAM rules, applications, distribution choices, or centrally managed identity can affect whether and how someone can log in.

How is password expiration different from account expiration?

Password expiration is a password-aging control: after the maximum age, the user may be prompted to change the password at the next login. The inactivity field can set a further period after password expiration, after which login is blocked pending administrator help.

Account expiration is separate: it prevents login for the account. An expired password and an expired account are therefore not interchangeable states. The account-expiration field is expressed as days since 1970-01-01, and the manual warns that 0 can be interpreted inconsistently.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What can go wrong when reading or editing these files?

  • Exposing /etc/shadow: Its protection depends on keeping it unreadable by regular users. The normal documented permission model makes /etc/passwd broadly readable, but not /etc/shadow.
  • Assuming a locked password disables the whole account: The marker blocks Unix-password authentication; other configured login paths may remain.
  • Confusing an empty field with a lock: Empty password fields can have different consequences from ! or * and should not be treated as a safe disable mechanism.
  • Changing fields without checking local policy: A mistaken delimiter or value can alter the interpretation of subsequent fields. The file format alone does not reveal PAM behavior, centrally managed identity, or distribution-specific account policy.

The vipw(8) manual documents vipw as the tool for editing /etc/passwd and /etc/shadow. Avoid casual direct edits; follow the account-management documentation for the distribution and identity setup in use. See the vipw(8) manual.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.