I'm just curious because I know the configuration for the password is located in /etc/passwd
, but in the document I don't see my actual password anywhere, obviously for security reasons. I opened passwd-
with less
in the terminal and it can't be found there either.
How does Ubuntu know and read the password you give it?
The password is not in /etc/password file in Unix systems ... some decades ago :)
The same policy is applied in Linux (Ubuntu too). Your passwords are encrypted in /etc/shadow file, and you need to be root to read the file. The passwords in /etc/shadow are hashed and this is an one-way operation. Ok, you will need (1) the string used for hash operation and (2) the hash algorithm used, and you can will try decrypt the /etc/shadow file (and remember, you will need root permissions for read this file).
You can find more details in this answer:
How to decode the hash password in ./etc/shadow
Passwords are stored in
/etc/shadow
. They are encrypted. Integrity of/etc/passwd
and/etc/shadow
can be verified via pwck command:Passwords were once storred in
/etc/passwd
, but then they were moved to/etc/shadow
to restrict access – while/etc/passwd
can be read by any user,/etc/shadow
is accessible only by root by default.