You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Graham Leggett <mi...@sharp.fm> on 2006/03/07 01:03:23 UTC

Protecting a file with a password

Hi all,

I have just tried to convince httpd v2.2.0 to password protect a single 
file on the filesystem, but without any success.

Does anybody know whether this is possible?

I tried

<Location /cgi-bin/dir/file.cgi>

and

<Files /full/path/to/cgi-bin/dir/file.cgi>

but neither of these seemed to do anything - the user was allowed to 
view the file without error or password.

The full config looks like this:

   <Files /full/path/to/cgi-bin/MT-3.2-en_US/mt-ldap.cgi>
     Options Indexes
     AllowOverride AuthConfig
     AuthBasicProvider ldap
     AuthType basic
     AuthName fileserver
     AuthLDAPBindDN yyy
     AuthLDAPBindPassword yyy
     AuthzLDAPAuthoritative on
     AuthLDAPURL ldap://127.0.0.1:389/yyy?mail?sub
     require ldap-group cn=yyy
   </Files>

Regards,
Graham
--

Re: Protecting a file with a password

Posted by Joshua Slive <jo...@slive.ca>.
On 3/6/06, Graham Leggett <mi...@sharp.fm> wrote:
> Hi all,
>
> I have just tried to convince httpd v2.2.0 to password protect a single
> file on the filesystem, but without any success.
>
> Does anybody know whether this is possible?
>
> I tried
>
> <Location /cgi-bin/dir/file.cgi>
>
> and
>
> <Files /full/path/to/cgi-bin/dir/file.cgi>

The first one should work.  The last one won't.  The recommended
config is something like
<Directory /full/path/to/cgi-bin/dir/>
<Files file.cgi>
...
</Files>
</Directory>

We should really give an error if you try to use a slash in a <Files> statement.

Joshua.