Details of /etc/shadow file in Linux
In Unix-like operating system their is a file “/etc/shadow” simply called as shadow file, which contain encrypted password of their system users, account or password expiry date, etc. The /etc/shadow file is not accessable by any of the local user and only read permission is given to the root user.This is to increase the security level of the system on user accounts and passwords.
The “/etc/shadow” file contains totally nine fields. Like the “/etc/passwd” file, the shadow file also had their entry of each and every user of the system with their account information in a seprate single line. The fields in the line are seprated by the colon (:) symbol.
The format of shadow file is shown below
Usrname : This is the login user name of the system
Encrypted-passwd : The Encrypted format of the login user password
Passwd-lastchg : It shows the Date of password last changed expressed as the number of days since Jan 1, 1970
Min-passwd-age : This is the password age that shows the minimum number of days required to change the password again, if number 0 is mentioned in this field means that there are no minimum password age is set.
Max-passwd-age : The shows the maximum number of days for the password to be valid.After the maximum nuber of days elapsed, the user is forced to change the password at the next time of their login.
Warn : This is to warn the user before a password expires, that the user must change their password before the expiry date of their password.
Passwd-inactive : This shows the number of days after password expires, since the account is disabled. The expiration of password and password inactive date is elapsed, the user can’t login with their current user’s password. If this field is empty means no password inactive period is set for that user.
Account-expire : This shows the expiry date of the user account on the system. once the expiry date is elapsed, no login can be used by that user name. If this field empty means no account expiry date is set for the user.
flag : This field is not currently used, this field is reserved for future use.
Informations stored in “/etc/shadow” file is look like below
In the above example the user name is testuser with encrypted password,lastpassword change date is set as 15391, their minimum password expiry date is set to 0,maxi,u, password expiry date is set to 99999 days ,warning for password expiry is set to 7 days and password & account inactive date are set to null.