Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Password protecting a folder with lighttpd
- # ==========================================
- # First, make yourself root.
- #
- # Replace the values in the first 5 lines (if necessary)
- # then copy the rest of the file into putty:
- user="ed"
- realm="javs"
- pass="hunter2"
- root="/var/www"
- dir="/topsecret"
- hash=$(echo -n "$user:$realm:$pass" | md5sum | cut -b -32) &&
- echo "$user:$realm:$hash" > "/etc/lighttpd/.passwd" &&
- { rm "/etc/lighttpd/conf-enabled/99-dauth.conf"; true; } &&
- echo '
- server.modules += ( "mod_auth" )
- auth.backend = "htdigest"
- auth.backend.htdigest.userfile = "/etc/lighttpd/.passwd"
- auth.require = ( "vDIR/" =>
- (
- "method" => "digest",
- "realm" => "vREALM",
- "require" => "valid-user"
- )
- )
- ' |
- sed "s*vDIR*$dir*" |
- sed "s*vREALM*$realm*" > \
- "/etc/lighttpd/conf-available/99-dauth.conf" &&
- ln -s \
- "/etc/lighttpd/conf-available/99-dauth.conf" \
- "/etc/lighttpd/conf-enabled/99-dauth.conf" &&
- service lighttpd restart &&
- echo "ok done" ||
- echo "something went fuck"
Advertisement
Add Comment
Please, Sign In to add comment