What is the use of /etc/shadow file in Linux?

In this article, you will learn about What is the use of /etc/shadow file in Linux?

The /etc/shadow file stores the actual password in an encrypted format. This file contains the account expiry information.

The /etc/shadow file maintains all the advanced algorithms. It has a lot of options for future updates.

There are nine fields to store encrypted passwords and other password-related information. There is a colon(:) to separate the areas.

cat /etc/shadow
vi /etc/shadow
shadow file in Linux
Shadow file format

1. Username

This is the name which you use to login to the computer.

2. Password

It is your encrypted password. The password should be a minimum of 8-12 characters long including special characters, digits, lower cases alphabetic, and more.

The password format $id$salt$hashed.

The $id is the algorithm.

$1$ is MD5
$2a$ is Blowfish
$2y$ is Blowfish
$5$ is SHA-256
$6$ is SHA-512

3. Last password change

This is about the last password change and it’s calculated from Jan 1, 1970.

4. Minimum number of days required between password changes

The minimum number of days required between password changes i.e. the number of days left before the user is allowed to change his/her password.

5. Maximum number of days the password is valid

The filed indicate the passwords maximum valid days.

6. Password expiry warning

This indicates the password expiry days. The user will get the password expiry warning.

7. Inactive Account

The number of days after a password expires that account is disabled.

8. Account Expire

This is calculated from days since Jan 1, 1970, that account is disabled i.e. an absolute date specifying when the login may no longer be used.

9. Reserved

Verify the integrity of passwd file

There is pwck command to verify the integrity of the users and authentication information.

pwck -r /etc/passwd
pwck -r /etc/shadow


In this tutorial, you learned about the /etc/shadow file Linux.  I hope, you understand, but if you have any questions, you can ask in the comment section.

Also, learn about

One comment

Leave a Reply