Apache configuration - Can authentication by group and also by individual users?

Tag: apache , authentication , httpd.conf Author: yondjing Date: 2013-04-06

I would like to know if I can merge group and specific users authorisation.

I have in my httpd.conf something like:

   <Directory /path/to/dir>
    AuthType Basic
    AuthName "Private pages"
    AuthBasicProvider file
    AuthUserFile /path/to/dir/.htpasswd
    AuthGroupFile /path/to/dir/.htgroup
    Require user user1 user2 user3
    Require group group1 group2
   </Directory>

Then I access it from browser. I use user1, I did not success and I got, in the error_log, the error:

 Authorization of user user1 to access /path/to/dir failed, reason: user is not part of the 'require'ed group(s).

Can I do it?

Other Answer1

Yes, but the user would have to match both the user directive AND the group directive. You should be able to use the

Satisfy Any

setting if you want just the group or the user directive to match

comments:

When I add the 'Satisfy Any' it allow to access the page without any authentication.
Hmm. You got any more directives in there? There are more things that could allow access, like "Allow from".
No, I have nothing but the lines I mention.