Ubuntu – what is difference between /etc/shadow and /etc/passwd

etcpasswd

Both files /etc/shadow and /etc/passwd seem to be the same, they just report some information about accounts. What is the difference between them?

Best Answer

Short answer:

passwd stores general user info and shadow stores user passwd info.

Somewhat longer answer:

passwd is the file where the user information (like username, user ID, group ID, location of home directory, login shell, ...) is stored when a new user is created.

shadow is the file where important information (like an encrypted form of the password of a user, the day the password expires, whether or not the passwd has to be changed, the minimum and maximum time between password changes, ...) is stored when a new user is created.

Some interesting extra info: passwd and shadow