Generating htpasswd entry with OpenSSL



Published: 2017-07-07 12:28:54 +0000
Categories: BASH,

Language

BASH

Description

Generally when generating a htpasswd entry for Basic Authentication you'd use apache-utils to do it. On a server running only NGinx, this probably won't be available, so you instead need to do it with openssl

Similar to

Snippet

printf "USER:$(openssl passwd -crypt PASSWORD)\n" >> .htpasswd

Usage Example

printf "joeblogs:$(openssl passwd -crypt A9n,6-l8)\n" >> .htpasswd

Requires

Keywords

HTPasswd, Nginx, Basic Authentication, Apache, passwd,

Latest Posts


Copyright © 2019 Ben Tasker | Sitemap | Privacy Policy
Available at snippets.bentasker.co.uk and snippets.6zdgh5a5e6zpchdz.onion