I would like to see how the login screen actually verifies that the password is correct. Does it have access to passwd file directly or does it refer to the judgment of some system function?
Authentication is implemented using PAM, the Pluggable Authentication Modules.
Linux-PAM is a system of libraries that handle the authentication tasks of applications (services) on the system. The library provides a stable general interface (Application Programming Interface - API) that privilege granting programs (such as login(1) and su(1)) defer to to perform standard authentication tasks.
The configuration for the login service is in
It's well-commented, and very informative.
It is PAM's modules that access to the password file, when needed. In systems with centralized authentication (for example LDAP), the login service may never need to access the password file.
See more info in
man 7 pam.