4

I'm new to Ubuntu i have made to 2 ordinary users in my Ubuntu and provided them same password but now i want to check is passwords are similar but don't know where to look for it or what command line to write in terminal. Where to find /etc/password.

  • User passwords are encrypted, you can not just "find" them. Also, what an annoying use of bold. – mikewhatever Dec 2 '17 at 11:48
5

There are two main files related to system user authentication: /etc/passwd and /etc/shadow. The actual user's passwords are stored as hashed version in the shadow file. They are hashed by the crypt function. It is not possible to "decrypt" any password from the shadow file, because hashing is one way mechanism.

Most simply: When the user enters а password, it is processed and compared to the hashed password stored in the shadow file. But when one try to "decrypt" a password from the shadow file - there are over than thousands possible results.

Relevant questions:


/etc/passwd contains one line for each user account, with seven fields delimited by colons (:).

These fields are: 1. login name; 2. optional encrypted password; 3. UID; 4. GID; 5. user name or comment field; 6. user home directory; 7. optional user command interpreter.

The encrypted password field may be blank, in which case no password is required... However, some applications which read the /etc/passwd file may decide not to permit any access at all if the password field is blank.

If the password field is a lower-case x, then the encrypted password is actually stored in the shadow file instead; there must be a corresponding line in the /etc/shadow file, or else the user account is invalid. If the password field is any other string, then it will be treated as an encrypted password, as specified by crypt. (source: man passwd)

/etc/shadow - shadowed password file - is a file which contains the password information for the system's accounts and optional aging information. Each line of this file contains 9 fields, separated by colons (:).

The fields are: 1. login name; 2. encrypted password - refer to crypt for details on how this string is interpreted; 3. date of last password change; 4. min password age; 5. max password age; 6. password warning period; 7. password inactivity period; 8. account expiration date; 9. reserved field. (source: man shadow).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.