Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

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>
share|improve this answer
    
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

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.

share|improve this answer
    
I don't understand how I could have the equivalent of a <Directory> for each... directory. Since my goal is to have different rules for each one. –  chriscatfr Sep 14 '11 at 15:26
    
sorry i missunderstood –  Mose Sep 14 '11 at 20:38

Your Answer

 
discard

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.