In this tutorial we will discuss about the topic Understanding /etc/shadow file in Linux.
The /etc/shadow file is also very important in Linux. It stores all the users passwords (in crypted format) and other security user account information.
The /etc/shadow file can be edited only by root and read by root and the group shadow:
# ls -l /etc/shadow
-rw-r----- 1 root shadow 1162 2012-06-02 08:15 /etc/shadow
The /etc/shadow contains a line for every user in the system. Each line has 8 fields, separated by colon (:).
# < /etc/shadow grep razvan
The 8 fields are:
- Username – the user’s login name
- Password – the password in crypted form. if instead of a password hash there is ! , that user cannot log in.
- Last password change – the date is displayed as the number of days since the 1st of January 1970
- Minimum – the minimum number of days between to password changes
- Maximum – the maximum number of days the password is valid
- Warn – how many days before the password expires is the user warned to change it’s password
- Inactive – the number of days that can pass after the password expiration before the account gets deactivated
- Expire – the day when the account will expire displayed as the number of days since the 1st of January 1970
Be carefull not to damage the /etc/password and the /etc/shadow file, or your system my crush.
Was this Tutorial helpful? Help others share on Facebook, Twitter, and Google Plus!