What Is /etc/shadow

Content on WhatAnswers is provided "as is" for informational purposes. While we strive for accuracy, we make no guarantees. Content is AI-assisted and should not be used as professional advice.

Last updated: April 11, 2026

Quick Answer: /etc/shadow is a critical Linux system file that stores encrypted password hashes and authentication metadata for user accounts, introduced in 1989 with the shadow password suite. Accessible only to the root user (permissions typically 640), it contains 9 colon-separated fields per user including the username, encrypted password hash, password aging information, and account expiration details. Unlike /etc/passwd which is world-readable, /etc/shadow's restricted access prevents attackers from obtaining password hashes for offline brute-force attacks.

Key Facts

Overview

/etc/shadow is a critical system file in Linux and Unix-like operating systems that securely stores encrypted password information for user accounts. Introduced in 1989 with the shadow password suite, this file represents a major security advancement by separating sensitive authentication data from the world-readable /etc/passwd file.

The primary purpose of /etc/shadow is to protect password hashes from unauthorized access while maintaining backward compatibility with legacy systems. By restricting file permissions to the root user, the system prevents unprivileged users and attackers from obtaining encrypted passwords that could be subjected to offline brute-force attacks. This architectural design has become the standard for modern Unix-like systems, significantly improving overall system security posture.

How It Works

/etc/shadow contains one line per user account, with each line consisting of nine colon-separated fields that work together to manage authentication and account lifecycle:

Key Comparisons

Aspect/etc/shadow/etc/passwd
Access PermissionReadable only by root (mode 640 or 600)Readable by all users (world-readable)
ContainsEncrypted password hashes and password aging dataUser information like UID, GID, home directory, shell
Security RiskLow; hashes protected from unauthorized accessHigher; visible to all users for potential attacks
File SizeGrows with each user account added to systemSimilar growth pattern but contains different data types
SynchronizationMust be manually kept in sync with /etc/passwd entriesPrimary user database file referenced during login

Why It Matters

The security significance of /etc/shadow cannot be overstated in modern Linux environments. Proper file permissions, regular backups, and monitoring of /etc/shadow changes are essential components of a comprehensive Unix-like system security strategy. System administrators must ensure that /etc/shadow and /etc/passwd remain synchronized while protecting /etc/shadow from unauthorized access through regular security audits and permission verification.

Sources

  1. Linux man-pages: shadow(5)GPL-2.0
  2. The Linux Kernel DocumentationGPL-2.0
  3. Wikipedia: PasswdCC-BY-SA-4.0

Missing an answer?

Suggest a question and we'll generate an answer for it.