There is a need when you need to create an account using password hash, follow below steps to simply create password hash.
$ openssl passwd -1
Password: <your pass>
Verifying - Password: <your pass>
Hash will appear here as an output
openssl is the command to generate password
passwd is an argument and -1 represents here that we want unix kind of hash from passwords as an output. There are other options too, like md5, crypt.
For example, you can use:
$ openssl passwd -crypt
or,
$ openssl passwd -md5
You can also provide the salt, to enhance the security
$ openssl passwd -crypt -salt (yourSalt)
This salt is required to decrypt the password.
You can also use python crypt function to create encrypted hashes:
# PASS="strongpass" python -c "import crypt; import os; print crypt.crypt(os.environ['PASS'], 'salt')"&
# ps fauxwww | grep 'python -c'
In this manner, the password will not appear in ps output.
To hide from history, you can disable and enable the history using following option
set +o history
# PASS="strongpass" python -c "import crypt; import os; print crypt.crypt(os.environ['PASS'], 'salt')"&
set -o history
So, go ahead and generate your hashes.
$ openssl passwd -1
Password: <your pass>
Verifying - Password: <your pass>
Hash will appear here as an output
openssl is the command to generate password
passwd is an argument and -1 represents here that we want unix kind of hash from passwords as an output. There are other options too, like md5, crypt.
For example, you can use:
$ openssl passwd -crypt
or,
$ openssl passwd -md5
You can also provide the salt, to enhance the security
$ openssl passwd -crypt -salt (yourSalt)
This salt is required to decrypt the password.
You can also use python crypt function to create encrypted hashes:
# PASS="strongpass" python -c "import crypt; import os; print crypt.crypt(os.environ['PASS'], 'salt')"&
# ps fauxwww | grep 'python -c'
In this manner, the password will not appear in ps output.
To hide from history, you can disable and enable the history using following option
set +o history
# PASS="strongpass" python -c "import crypt; import os; print crypt.crypt(os.environ['PASS'], 'salt')"&
set -o history
No comments:
Post a Comment