Per-file auth

This is a discussion on Per-file auth within the Apache Web Server forums, part of the Web Server and Related Forums category; Hi all, I'm unsucessfull to find a way to do this : In a given folder I want to use ...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-06-2008
Nicolas BOUTHORS
 
Posts: n/a
Default Per-file auth

Hi all,

I'm unsucessfull to find a way to do this :

In a given folder I want to use Auth (LDAP based would be gread but
basic sufficient). The folder contains one file per user. Each user
shall only have access to the file named after him. I obviously don't
want to generate a set of rule for each user but a global conf.

Some kind of ninja RewriteCond maybe ?

Thanks !

Nicolas

--
Nicolas - 06 20 71 62 34 - http://nicolas.bouthors.org/album/
  #2 (permalink)  
Old 03-10-2008
Nicolas BOUTHORS
 
Posts: n/a
Default Re: Per-file auth

Nicolas BOUTHORS a écrit :
> In a given folder I want to use Auth (LDAP based would be gread but
> basic sufficient). The folder contains one file per user. Each user
> shall only have access to the file named after him. I obviously don't
> want to generate a set of rule for each user but a global conf.


Anyone ?


--
Nicolas Bouthors -=- Tel : 06 20 71 62 34 -=- Fax : 01 46 87 21 99
NBi SARL -=- http://nbi.fr -=- nbouthors@nbi.fr
  #3 (permalink)  
Old 03-10-2008
Luuk
 
Posts: n/a
Default Re: Per-file auth

Nicolas BOUTHORS schreef:
> Hi all,
>
> I'm unsucessfull to find a way to do this :
>
> In a given folder I want to use Auth (LDAP based would be gread but
> basic sufficient). The folder contains one file per user. Each user
> shall only have access to the file named after him. I obviously don't
> want to generate a set of rule for each user but a global conf.
>
> Some kind of ninja RewriteCond maybe ?
>
> Thanks !
>
> Nicolas
>


may be use mod_rewrite to rewrite the URL based on username?
but this depends a bit on your statement
"Each user shall only have access to the file named after him."


--
Luuk
  #4 (permalink)  
Old 03-10-2008
Nicolas BOUTHORS
 
Posts: n/a
Default Re: Per-file auth

Luuk a écrit :
> may be use mod_rewrite to rewrite the URL based on username?


That was one of my ideas, but I couldn't find how to implement. Care to
give an example of how you see it ?

> but this depends a bit on your statement
> "Each user shall only have access to the file named after him."


Bob can access the file named bob, and not the file jack.
Jack can access the file named jack and not the file bob.

N

--
Nicolas Bouthors -=- Tel : 06 20 71 62 34 -=- Fax : 01 46 87 21 99
NBi SARL -=- http://nbi.fr -=- nbouthors@nbi.fr
  #5 (permalink)  
Old 03-10-2008
Luuk
 
Posts: n/a
Default Re: Per-file auth

Nicolas BOUTHORS schreef:
> Luuk a écrit :
>> may be use mod_rewrite to rewrite the URL based on username?

>
> That was one of my ideas, but I couldn't find how to implement. Care to
> give an example of how you see it ?
>
>> but this depends a bit on your statement
>> "Each user shall only have access to the file named after him."

>
> Bob can access the file named bob, and not the file jack.
> Jack can access the file named jack and not the file bob.
>
> N
>


maybe i was nog clear ;-)
let met try to explain what i meant.

if you redirect all users for that directory to index.php

and your index.php looks like this:
<?php
include(getenv("REMOTE_USER").".html");
?>


Then, if jack logs on, he will see jack.html, and not bob.html
and bob will see bob.html, and not jack.html

a new user (i.e. susan) will work instantly, (after susan.html is created)



--
Luuk
  #6 (permalink)  
Old 03-10-2008
Nicolas BOUTHORS
 
Posts: n/a
Default Re: Per-file auth

Luuk a écrit :
> and your index.php looks like this:
> <?php
> include(getenv("REMOTE_USER").".html");
> ?>


Yeah yeah. I wanted to NOT need PHP. Hence posting in an Apache related
forum. Your solution is trivial, but requires PHP.

Cheers,
N

--
Nicolas Bouthors -=- Tel : 06 20 71 62 34 -=- Fax : 01 46 87 21 99
NBi SARL -=- http://nbi.fr -=- nbouthors@nbi.fr
  #7 (permalink)  
Old 03-10-2008
Luuk
 
Posts: n/a
Default Re: Per-file auth

Nicolas BOUTHORS schreef:
> Luuk a écrit :
>> and your index.php looks like this:
>> <?php
>> include(getenv("REMOTE_USER").".html");
>> ?>

>
> Yeah yeah. I wanted to NOT need PHP. Hence posting in an Apache related
> forum. Your solution is trivial, but requires PHP.
>
> Cheers,
> N
>



The nice thing is, once you read the docs, you will see that
mod_rewrite is also capable of using REMOTE_USER variable....

so, redirection, based on 'REMOTE_USER' is also possible without PHP

(http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html)


--
Luuk
  #8 (permalink)  
Old 03-10-2008
Nicolas BOUTHORS
 
Posts: n/a
Default Re: Per-file auth

Luuk a écrit :
> The nice thing is, once you read the docs, you will see that
> mod_rewrite is also capable of using REMOTE_USER variable....
>
> so, redirection, based on 'REMOTE_USER' is also possible without PHP
>
> (http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html)


Yeah I know. But we are drifting away from the original question. Not a
problem, I'll implement this as PHP.

Cheers,
Nico

--
Nicolas Bouthors -=- Tel : 06 20 71 62 34 -=- Fax : 01 46 87 21 99
NBi SARL -=- http://nbi.fr -=- nbouthors@nbi.fr
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 07:08 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0