Back to course

47. Security Focus: The `/etc/shadow` File

Linux Basics: From Zero to CLI Hero

Encrypted Passwords

The /etc/passwd file must be world-readable for system processes to function, which is a security risk if passwords were stored there. The /etc/shadow file solves this by storing sensitive information, readable only by root.

What it Stores

Each line corresponds to a user in /etc/passwd and contains critical security data:

  1. Username
  2. Encrypted Password: A long string of characters (the hash and salt).
  3. Last password change date
  4. Minimum days between password changes
  5. Maximum days until password change required
  6. Days warning before password expiration
  7. Days after expiration until account disabled (inactivity)

Key Takeaway: You should never need to manually edit /etc/shadow. Use passwd and other user management tools.