2

How could I give different access to sub-directories?

The first problem is: I must let the programmers modify the htaccess files, but not the access control.

I have access only to htaccess directives for once, not to the httpd.conf of Apache. And here are my folders:

~/www/
~/beta/ -> group betatesters developers
~/dev/ -> group developers

I would like to have only one .htaccess located in the root directory (developers don't have access there).

~/.htaccess
~/htpassd
~/htgroup

.

AuthType Basic
AuthName "Password Required"
AuthUserFile /home123/user321/htpasswd
AuthGroupFile /home123/user321/htgroup
<FilesMatch "beta">
    Require group betatesters developers
</FilesMatch>

<FilesMatch "dev">
    Require group developers
</FilesMatch>

Any idea?

Joshua Hoblitt
  • 675
  • 4
  • 11
chriscatfr
  • 123
  • 4

2 Answers2

1

You can set in the Apache conf what parameters are fair game to be changed in a .htaccess file. http://httpd.apache.org/docs/2.0/mod/core.html#allowoverride

In your specific example, you don't want the AuthConfig settings to be overidable. You can do that either by not listing AuthConfig with the AllowOveride directive. eg.

<Directory foo>
   AllowOveride Indexes <...>
</Directory>

Or explicitly declaring that AuthConfig is not modifiable.

<Directory foo>
   AllowOveride -AuthConfig <other options here>
</Directory>
Joshua Hoblitt
  • 675
  • 4
  • 11
  • it's not that I don't want Authconfig to be overidable or not, it's that I want a different one for each. And in a perfect world it would not be in .htacces in each directory itself – chriscatfr Sep 14 '11 at 16:01
1

after you stated you DON'T have access to httpd.conf, Joshua Hoblitt answer only applies partially.

if it is possible for you to use another directory structure like

~/www
~/www/beta
~/www/dev

you could adapt Joshua's solution.

Mose
  • 654
  • 8
  • 15