Information
Hash functions behave as one-way functions by using mathematical operations that are extremely difficult and cumbersome to revert
When a user is created, the password is run through a one-way hashing algorithm before being stored. When the user logs in, the password sent is run through the same one-way hashing algorithm and compared to the hash connected with the provided username. If the hashed password and the stored hash match, the login is valid.
The SHA512 hashing algorithm provides stronger hashing than previous available algorithms like MD5 thus providing additional protection to the system by increasing the level of effort for an attacker to successfully determine passwords.
Solution
Note:
- Pay special attention to the configuration. Incorrect configuration can cause system lock outs.
- This is an example configuration. Your configuration may differ based on previous changes to the files.
- The encryption method on the password success line for pam_unix.so and the ENCRYPT_METHOD line in /etc/login.defs should match.
Edit the /etc/pam.d/common-password file and ensure that sha512 is included and the pam_unix.so success line:
Example:
password [success=1 default=ignore] pam_unix.so obscure sha512 use_authtok
Edit /etc/login.defs and ensure that ENCRYPT_METHOD is set to SHA512
ENCRYPT_METHOD SHA512