Replace the existing hash key ( md5, des, or sha256) with sha512 or append sha512, if there is no existing key. For example:
password sufficient /lib/security/$ISA/pam_unix.so use_authtok nullok shadow sha512
Note: Changing the hash method does not rehash existing passwords. It only impacts the format in which future passwords are stored when new accounts are created and passwords of existing accounts are modified.
Encryption Method | Tag as seen in the /etc/shadow file |
DES | 13-char |
MD5 | $1$ |
SHA256 | $5$ |
SHA512 | $6$ |