What is the /etc/shadow file?

QuestionsQuestions8 SkillsProUser Account ManagementSep, 16 2025
0228

The /etc/shadow file in Linux is a system file that stores encrypted password information and related account settings for user accounts. It is designed to enhance security by restricting access to sensitive password data. Here are the key features and structure of the /etc/shadow file:

Key Features:

  • Security: Only the root user and processes with elevated privileges can read this file, protecting it from unauthorized access.
  • Password Management: It contains information about password expiration, aging, and account status.

Structure:

Each line in the /etc/shadow file corresponds to a user account and contains the following fields, separated by colons (:):

  1. Username: The name of the user account.
  2. Encrypted Password: The hashed password for the user. If the password is locked, this field may contain a special character (e.g., ! or *).
  3. Last Password Change: The number of days since January 1, 1970, when the password was last changed.
  4. Minimum Password Age: The minimum number of days required before the password can be changed.
  5. Maximum Password Age: The maximum number of days the password is valid before it must be changed.
  6. Password Warning Period: The number of days before password expiration that the user is warned to change their password.
  7. Inactive Period: The number of days after password expiration before the account is disabled.
  8. Account Expiration Date: The number of days since January 1, 1970, when the account will be disabled.
  9. Reserved Field: A field reserved for future use.

Example Entry:

bob:$6$saltsalt$hashedpassword:18000:0:99999:7:::

In this example:

  • bob is the username.
  • $6$saltsalt$hashedpassword is the hashed password using SHA-512 with a salt.
  • The remaining fields provide information about password aging and account status.

The /etc/shadow file is crucial for managing user authentication and ensuring the security of user accounts in a Linux system.

0 Comments

no data
Be the first to share your comment!