[Linux] Different dirs for different logins with apache?

Aaron Wolfe linux@flux.org
Mon, 4 Jun 2007 13:45:06 -0400


Reading the docs, it seemed like it was possible with mod_rewrite but my
quick attempt at figuring it out got me nowhere.  I'm sure with enough
time it could be done, and doing it this way would be the most seamless
imho.
If anyone ever figures it out or finds an example (I couldn't find any
examples of using REMOTE_USER) I'd love to see it.=20

As for using cookies, Mysql and php... you're kidding right?  Talk about
using a shotgun to swat flies :)  A simple perl script and an htpasswd
file would do the trick, I just didn't think that was the best way to
go, hence my original question.

Thanks for all the help
-Aaron


-----Original Message-----
From: linux-admin@flux.org [mailto:linux-admin@flux.org] On Behalf Of
Danny Rathjens
Sent: Monday, June 04, 2007 10:17 AM
To: linux@flux.org
Subject: Re: [Linux] Different dirs for different logins with apache?

Yeah, that was what I was thinking.  Using mod_rewrite to redir to a
specific
dir based on the environment var indicating the user they authenticated
as;
which is $REMOTE_USER.

Kendrick Vargas wrote:
> I don't know that you couldn't do what the dude wanted with
mod_rewrite.
> In fact it'd probably make his life easier, though there'd definitely
be
> some trick involved.
>=20
> If apache allows setting variables within the configuration file based
> on some other criteria (and I believe it does), he could write a
rewrite
> rule that does an internal redirect (invisible to the outside user) to
a
> seperate file or webroot. I think it'd be possible, but it'd take some
> work on the part of the configurator.
> 			-peace
>=20
> Michael Beal wrote:
>> Yes, it is possible, Aaron.  Using mod_rewrite as Danny suggests
won't
>> get it.  mod-rewrite doesn't work that way.  mod_rewrite, AFAIK, is a
>> URL scrubber.
>>
>> 1) Set up a session cookie which will authenticate the user and
expires
>> after a preset amount of time.
>> 2) Set up a MySQL DB that handles logins and "home" folders.
>> 3) Do some PHP script to determine who gets to see what.
>> 4) Add an .htaccess file to each directory that restricts access to
>> anyone other than the sysadmin(root) and webserver user(www or
www-data
>> or www-html).  I know this seems odd but remember that only Apache is
>> going to be accessing the logged in user's folder so there's no issue
>> with locking yourself out.
>>
>> As for the .htaccess file, you could get really tricky and force file
>> accesses to the logged in user.  Don't ask me how on that one
though...
>>  No clue.
>>
>> --- Aaron Wolfe <Aaron@kdtsolutions.com> wrote:
>>
>>> Hi,
>>>
>>> =20
>>>
>>> I am not sure if this is possible, but thought one of the experts
>>> here
>>> might point me in the right direction.
>>>
>>> I would like to have a website that requires user authentication,
and
>>> depending on the login supplied, serves up one of many different web
>>> roots.  In other words, if you login as Bob you see one website and
>>> if
>>> you login as Terry you see a completely different one, with no way
to
>>> navigate between the two.
>>>
>>> =20
>>>
>>> I could do this with a cgi that redirects based on the user, but I
>>> don't
>>> think it would be ideal or all that secure and I was hoping apache
>>> could
>>> be setup to do this automagically.  I haven't found much about this
>>> searching on the web, so any ideas are appreciated.
>>>
>>> =20
>>>
>>> -Aaron
>>>
>>> =20
>>>
>>>
>>
>>
>>       =20
>>
________________________________________________________________________
____________
>> Be a better Heartthrob. Get better relationship answers from someone
who knows. Yahoo! Answers - Check it out.=20
>> http://answers.yahoo.com/dir/?link=3Dlist&sid=3D396545433
>> _______________________________________________
>> Linux mailing list
>> Linux@flux.org
>> http://www.flux.org/mailman/listinfo/linux
> _______________________________________________
> Linux mailing list
> Linux@flux.org
> http://www.flux.org/mailman/listinfo/linux
>=20
_______________________________________________
Linux mailing list
Linux@flux.org
http://www.flux.org/mailman/listinfo/linux