← Notes

Create encrypted passwords with htpasswd

Create encrypted passwords with htpasswd


December 8, 2020

Tags: passwords
htpasswd

First install the necessary package:

sudo apt-get install apache2-utils

To create a user/password pair run:

htpasswd -Bn <user>

Enter the password and then confirm it.

If you're using htpasswd to create user/password pairs with Traefik then you have to excape the dollar signs with an extra dollar sign. This can be accomplished easily through the following command:

echo $(htpasswd -Bn <user>) | sed -e s/\\$/\\$\\$/g