Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have problem with Authorization in httpd. when I connect to http:/user1
the login screen pop up and user1,user2 can login and show the user1's data. how can I create a rule that user1 can only browse user1 folder, and other users can only login to their own folder ? thanks

User list in home folder /home/user1 /home/user2

vi /etc/httpd/.htpasswd

user1:$apr1$NWoTku5D$frFdpU6Y9eoZ4y1KZVGa60 user2:5D$frFdpU6Y9eoZ4y1KZVGa60$apr1$NWoTku

vi /etc/httpd/conf/httpd.conf

AllowOverride AuthConfig
AuthType basic
AuthName "Media Zone"
AuthUserFile /etc/httpd/.htpasswd
Require valid-user

share|improve this question

I believe you have put that for the default Document Root that is /var/www in Debian/Ubuntu based servers and /var/www/html for redhat/centos.

You have to make multiple virtual hosts

make one for user1 for example in /var/www/html/user1 make other for user2 in /var/www/html/user2

Create different .htpasswd file for each user and put that in the Virtual host file accordingly.

share|improve this answer
It works, thanks for all the help. – stefanus Nov 28 '12 at 0:05

Another option could be an index.php where you can query $_SERVER['REMOTE_USER']. Depending on the name you could redirect to different static pages or just build dynamic pages suited for the user.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.