Page 1 of 1

Generate encrypted passwords using openssl

Posted: Wed Jan 24, 2024 3:35 pm
by cah
It is convenient to generate encrypted passwords from command line without prompt.

Here is a useful command to use openssl to generate MD5 passwords.

Code: Select all

echo '<PWD>' | openssl passwd -1

Code: Select all

-1                 MD5-based password algorithm
-apr1              MD5-based password algorithm, Apache variant

Example:

Code: Select all

echo 'testpwd' | openssl passwd -1 -stdin
$1$Ei/7/eUx$4b7R85DMjEbiEa/4m7YG5/

echo 'testpwd' | openssl passwd -apr1 -stdin
$apr1$pOyUUu0L$bzaZpE.9pGKk0ZApkFGaP/