The passwords are not stored anywhere on the system at all. What is stored in /etc/shadow
are so called hashes of the passwords.
A hash of some text is created by performing a so called one way function on the text (password), thus creating a string to check against. By design it is "impossible" (computationally infeasible) to reverse that process.
Older Unix variants stored the encrypted passwords in /etc/passwd
along with other information about each account.
Newer ones simply have a *
in the relevant field in /etc/passwd
and use /etc/shadow
to store the password, in part to ensure nobody gets read access to the passwords when they only need the other stuff (shadow
is usually protected more strongly than passwd
).
For more info consult man crypt
, man shadow
, man passwd
.