Created
April 1, 2011 19:06
-
-
Save hankpillow/898671 to your computer and use it in GitHub Desktop.
this script creates htaccess files in the same root as when you called this script
This file contains hidden or 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 | |
user=$1; | |
if [ "$user" = "" ] | |
then | |
echo -n "user name:" | |
read user | |
fi | |
pwd | awk '{root = $1}; END {print "AuthName \"Secure Area\"\nAuthType Basic\nAuthUserFile " root "/.htpasswd\nrequire valid-user" }' > .htaccess | |
htpasswd -c .htpasswd $user | |
chmod 644 .htpasswd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
chmor +x path-to-this-gist