httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Slive <jos...@slive.ca>
Subject Re: [users@httpd] Limit user per directory
Date Tue, 07 Feb 2006 16:15:46 GMT
On 2/6/06, Cj B <black@comet.n-polk.k12.ia.us> wrote:
> Hello, I have a question about limiting users to a direcotry,
> basically I want to limit the users to a certain directory. ie: user1
> would be limited to browsing user1's directory. Currently I am doing
> the following for each user in the htpasswd file:
>
> Alias /user1 "/export/home/user1"
> <Directory "/export/home/user1">
>      AuthName Admin
>      AuthType Basic
>      AuthUserFile /usr/local/apache1/conf/cliweb-passwd
>      Options None
>      AllowOverride None
>      Order allow,deny
>      Allow from all
>      require user user1
> </Directory>
>
> I was wondering if there's a faster way to do this, so that I don't
> have to create an entry for each user?

Something like this:
<Directory /export/home>
...
require valid-user
</Directory>
RewriteEngine On
RewriteCond %{LA-U:REMOTE_USER} (.+)
RewriteRule ^/(.*) /export/home/%1/$1

This actually hides the users' directory name, which may or not be
what you want.  Also be careful about what happens if REMOTE_USER is
empty.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message