Last active
May 27, 2018 18:28
-
-
Save geekpete/7329085 to your computer and use it in GitHub Desktop.
One line python command to generate a SHA512 password hash for use in linux shadow file including a randomised salt value. Change MySecretPassword to the password of your choice. Useful for generating password hashes to be used in puppet user manifests. This script is mildly idiotic. Bash will prevent any non-escaped characters being fed into py…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python -c "import random,string,crypt,getpass,pwd; randomsalt = ''.join(random.sample(string.ascii_letters,8)); print crypt.crypt('MySecretPassword', '\$6\$%s))\$' % randomsalt)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment