Setup Apache Password Protection
Posted
by
Jiew Meng
on Server Fault
See other posts from Server Fault
or by Jiew Meng
Published on 2011-02-21T09:51:05Z
Indexed on
2011/02/21
15:26 UTC
Read the original article
Hit count: 257
apache
|password-protected
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
© Server Fault or respective owner