How to make 'htpasswd' print hashed password on stdout
You can use the htpasswd
-n
flag to make it print the hashed password to stdout instead of writing it to a file.
htpasswd -n username
or, if you want to use a password given on the command line:
htpasswd -nb username password
Another way is to use /dev/stdout
as the output file:
htpasswd -c /dev/stdout username
Example output
username:$apr1$KwZDqK6Q$Sr6/.MLMv5JUuFPSNY30L/
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow