0

I have multiple vhosts on a host running apache. It is a test system and I would like to give users "basic authentication" access to their sites.

For this I have a vhost file with basic auth configuration:

<VirtualHost *:80>
    ServerName demo.com
    ServerAlias test.demo.com
    DocumentRoot /filepath/to/demo.com/public_html
    <Location />
        Deny from all
        AuthUserFile /filepath/to/demo.com-users
        AuthName authorization
        AuthType Basic
        Satisfy Any
        require valid-user
    </Location>
</VirtualHost>

This works fine and can be done per virtual host domain.

Question: For the staff I would like to set a global "auth directive" in the normal httpd.conf file that allows them to login to all vhosts in one step.

Can this be done and how?

raoulsson
  • 4,763
  • 10
  • 34
  • 29

1 Answers1

1

You could define a single password file for all your users and then create a groups file to classify them according to their virtual host permissions. You could have a special group for the staff.

Then instead of require valid-user you could use the following.

AuthGroupFile /usr/local/apache/passwd/groups
Require group GroupName

For reference you can read the Letting more than one person in section in https://httpd.apache.org/docs/2.2/howto/auth.html

cjungel
  • 236
  • 2
  • 5