Setup Apache Password Protection
- by Jiew Meng
I have some difficulties setting up password protection in Apache
In .htaccess, I have
AuthUserFile /var/www/vhosts/domain.net/httpdocs/.htpasswd
AuthGroupFile /dev/null
AuthName "Test Server"
AuthType Basic
require user testuser
Then in .htpasswd, I have something like
testuser:encrypted password
The problem now is I forgot what .htpasswd generator I used. When I try to add a new user and password, it doesn't work. eg. when I put require user newuser it fails always (prompt keeps reappearing). Then when I revert to testuser it works
How can I setup such that I have 1 or some "admins" that can access everything and viewers that can view only specific folders ... eg
/ - only admins
/folder1 - only admins or folder1's users
/folder2 - only admins or folder2's users
Also what do I do to not allow showing of directory listing