This is the first time that I have ever tried working with .htpasswd and .htaccess files, so please point out my childish works.
I have my apache document root set to /www/
on my debian server. Inside it, there's a folder named Logs/
which I want to restrict access using a htpasswd. I created my htpasswd file using the shell's htpasswd command. And this is the result:
user:<encoded password here>
hjp:<encoded password here>
hjpotter92:<encoded password here>
I put this file named .htaccess
inside /www/
. The Logs/
has following htaccess file in it:
AuthName "Restricted Area"
AuthType Basic
AuthUserFile /www/.htpasswd
AuthGroupFile /dev/null
require valid-user
This was again created using an online tool(I forgot its name/link, and can't search the browser-history now).
The problem, as it might've already struck you is that I am experiencing no change on my Logs folder access. The folder is still accessible to everyone. I am running apache as root user(if that matters/helps). Please help/guide me. I've tried reading some htaccess guides and have followed some of older SO questions, but still haven't figured out a way to restrict access to Logs folder with a password.
.htaccess
, and you should: 1.) not run apache as root (terrible for security), and 2.) use digest authentication unless you're only accessing that URL via HTTPS. Because even if your.htpasswd
file is SHA1 encrypted, the browser will be sending the password in plain-text if you use basic authentication.