I know that passwords are stored in /etc/shadow
As Gilles already stated, only password hashes are stored in
/etc/shadow, moreover, this is just one of the possible locations, they might be stored globally on a
ldap server or a
However, during the login process, I'm assuming that Linux take your username and password as an argument, encrypt your password with the same algorithm and compare it to the one stored in the shadow.
The process is much more flexible than that. Depending on the
PAM configuration, the system might check multiple modules in sequence, and will stop if either one of the module succeed and is declared to be sufficient or alternatively if a module fails and is declared as requisite. Modules are able to establish a dialog with the user trying to log in so what is provided is not necessarily a couple of username/password. For example, a user can be granted access without providing any password when using
pam_rhosts_auth). He must be warned the password is about to expire, be prompted to change an expired password, and similar interactive tasks.
My question is, where does this process take place? (the code) I tried to search the PAM but I couldn't find anything useful there either.
Gilles also already replied to that question,
pam_unix is handling
/etc/shadow files entries.