When setting up WUD (What’s up Docker?), I needed to enable basic
authentication to protect the web interface. Normally, this requires
generating a password hash — but I didn’t have the htpasswd tool
installed.
After a bit of searching, I discovered that OpenSSL can do the same thing with a single command:
openssl passwd -apr1
This command prompts you to enter a password and returns its Apache
MD5-based hash, which works perfectly for WUD or any service expecting
an .htpasswd format.
There are several other ways to create password hashes, but since
openssl is usually preinstalled on most systems, this method is quick
and convenient.
💡 Tip: You can also use flags like -stdin to pass passwords
directly from scripts if needed — just remember not to expose plain
text passwords in your shell history.