To upgrade the password hashing algorithm to SHA-512 on a Linux system, follow these steps:
- Open the
/etc/login.defsfile with a text editor, such asviornano. - Locate the line that contains the
ENCRYPT_METHODparameter. If the parameter is commented out with a#symbol, remove the symbol to uncomment it. - Change the value of
ENCRYPT_METHODfrom the default value toSHA512.
For example, the line should look like this after the change:
ENCRYPT_METHOD SHA512
- Save and close the file.
- Change the password of each user on the system so that the new SHA-512 algorithm is used. To do this, use the
passwdcommand followed by the username.
For example, to change the password for the user john, run the following command:
sudo passwd john
- Enter and confirm the new password when prompted.
Note that after you change the password, the new hash will be stored in the /etc/shadow file. This file should only be readable by the root user, to protect the security of the password hashes. (https://www.sanjaytaxpro.com/)