Created
July 9, 2019 18:07
-
-
Save jqqqqqqqqqq/903516d1541fd0b9c01609006a75fe0e to your computer and use it in GitHub Desktop.
Nginx http auth without apache util
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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