Password hash in CentOS 7/8

If you want to create a password hash that you want to put into your cloud-init configuration, it is possible to use a plain-text password. But you can use a hash so nobody can see the password.

Some Linux distributions have the mkpasswd utility, but on CentOS this is not available.

You can use a python one-liner to generate a SHA512 password hash:

python -c 'import crypt,getpass; print(crypt.crypt(getpass.getpass(), crypt.mksalt(crypt.METHOD_SHA512)))'

Execute the one-liner and type in your password.

More info here:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.