While I work, I need to create random passwords as well as create SHA512 hashed password so it can be added into places like kickstart and so on.
To create a random password
# date +%s | sha512sum | base64 | head -c 32 ; echo</strong>
MjE2NmQwZDQwMWUzMzQ5Yjk2ZDliMGJj
To create a SHA512 hashed password
This is based on https://access.redhat.com/solutions/221403
However, with python3, “print” needs to be in “print ()” form.
# python3 -V</strong>
Python 3.9.2
# python3 -c 'import crypt,getpass; print (crypt.crypt(getpass.getpass()))'</strong>
Password:
$6$21eDal65kOhgvewf$EZLptcc4dOaC3/Fk8Js.seOslXTvt5JQF5TqPssft1tLCmoAZANMdGaqeZidGSVJ7X1RBIn/2xByfTvI9XAzg/