I am trying to automate creating a password from the command line. I have tried the below but it still keeps asking for the password.
echo "test101" | htpasswd -c ~/temp/password admin
How to generate automate htpasswd
from command line without typing password?
Use the htpasswd generator to create passwords for htpasswd files. Just enter username and password and an entry for a htpasswd file is generated. You can use the htaccces Authentication generator to create a htaccess file that will password protect your site or a directory.
htpasswd is used to create and update the flat-files used to store usernames and password for basic authentication of HTTP users.
htpasswd file in /var/www . You can place the . htpasswd pretty much anywhere other than your web folder.
Why not just use:
htpasswd -b -c ~/temp/password admin test101
If you don't have htpasswd
installed (for example when using nginx) you can generate a password with openssl.
printf "USER:$(openssl passwd -crypt PASSWORD)\n" >> .htpasswd
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With