Skip to content

Instantly share code, notes, and snippets.

@jqqqqqqqqqq
Created July 9, 2019 18:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jqqqqqqqqqq/903516d1541fd0b9c01609006a75fe0e to your computer and use it in GitHub Desktop.
Save jqqqqqqqqqq/903516d1541fd0b9c01609006a75fe0e to your computer and use it in GitHub Desktop.
Nginx http auth without apache util
#!/bin/bash
# read username
read -p "Username: " username
# read password twice
read -s -p "Password: " password
echo
read -s -p "Password (again): " password2
# check if passwords match and if not ask again
while [ "$password" != "$password2" ];
do
echo
echo "Please try again"
read -s -p "Password: " password
echo
read -s -p "Password (again): " password2
done
printf "$username:$(openssl passwd -crypt $password)\n" >> .htpasswd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment