Skip to content

Instantly share code, notes, and snippets.

@slavafomin
Last active February 18, 2021 14:59
Show Gist options
  • Save slavafomin/ea7c814cf5f0a2a9d28cae11705dca58 to your computer and use it in GitHub Desktop.
Save slavafomin/ea7c814cf5f0a2a9d28cae11705dca58 to your computer and use it in GitHub Desktop.
Generate .htpasswd file for nginx basic authentication
#!/usr/bin/env bash
read -p "Username: " USERNAME
read -s -p "Password: " PASSWORD; echo
printf "${USERNAME}:$(openssl passwd -crypt ${PASSWORD})\n" >> ./.htpasswd
@shesek
Copy link

shesek commented Feb 14, 2021

You're not actually doing anything with SALT_LENGTH?

@slavafomin
Copy link
Author

You're not actually doing anything with SALT_LENGTH?

Yep, I've updated the example to remove unnecessary variable. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment