I want to add a user using useradd and specify an encrypted password using the -p flag. I learned that the unix system that I am on uses a SHA512 hash for storing passwords in the /etc/shadow file. When I look in /etc/pam.d/common-password, it says this:
# Explanation of pam_unix options:
#
# The "sha512" option enables salted SHA512 passwords. Without this option,
# the default is Unix crypt. Prior releases used the option "md5".
#
# The "obscure" option replaces the old `OBSCURE_CHECKS_ENAB' option in
# login.defs.
#
# See the pam_unix manpage for other options.
# here are the per-package modules (the "Primary" block)
password [success=1 default=ignore] pam_unix.so sha512
I just need to know what the salt is, so that I can generate the hash and use it with my
useradd ... ... -p INSERT_HASHED_PASS_HERE
mkpasswd -s $SALT -m sha-512
with any value you wish for$SALT
.sha512
=6
), the salt, and the hashed, salted password. It is all included in the-p
argument.