View previous topic :: View next topic |
Author |
Message |
quart n00b
Joined: 14 May 2005 Posts: 6
|
Posted: Fri May 16, 2008 2:36 pm Post subject: apache file authorisation fails |
|
|
Hi,
I am trying to protect a single file in a cgi-bin directory from the vqadmin package. I have a clean installation and nothing fancy yet.
This is the relevant part of /etc/apache2/vhosts.d/default_vhost.include
ScriptAlias /cgi-bin/ "/var/www/localhost/cgi-bin/"
Code: | <Directory "/var/www/localhost/cgi-bin">
AllowOverride AuthConfig
Options All
Order allow,deny
Allow from all
</Directory>
<Files "/var/www/localhost/cgi-bin/vqadmin">
AuthType Basic
AuthUserFile /var/www/localhost/vqadmin.passwd
AuthName vqadmin
Require valid-user
</Files> |
I don't get a login screen. I tried to change Files to Location, and that also didn't help. mod_auth_basic does work, as I tested it in another directory. What am I missing here? _________________ "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo VP, 1989 |
|
Back to top |
|
|
elgato319 Guru
Joined: 15 Sep 2005 Posts: 546
|
Posted: Mon May 19, 2008 1:11 pm Post subject: |
|
|
I would do it like this:
add an .htaccess to the cgi-bin dir
Code: | Options Indexes
AuthType Basic
AuthUserFile /var/www/localhost/vqadmin.passwd
AuthName "vqadmin"
<Files vqadmin>
Require valid-user
</Files> |
|
|
Back to top |
|
|
quart n00b
Joined: 14 May 2005 Posts: 6
|
Posted: Mon May 19, 2008 1:29 pm Post subject: |
|
|
Yes that did the trick. But why wouldn't it work from the apache configuration? I tried to put the <files></files> between the <directory> tags, and above the directory tags, all with no result. I would expect it should work. Or is this new behaviour in Apache 2.2? _________________ "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo VP, 1989 |
|
Back to top |
|
|
quart n00b
Joined: 14 May 2005 Posts: 6
|
Posted: Mon May 19, 2008 1:49 pm Post subject: |
|
|
I found it. Authorisation has to be placed inside directory tags, not the file tags, like this:
<Directory "/var/www/localhost/cgi-bin">
AllowOverride All
Options None
Order allow,deny
Allow from all
Options Indexes
AuthType Basic
AuthUserFile /var/www/localhost/vqadmin.passwd
AuthName "vqadmin"
</Directory>
<Files vqadmin>
Require valid-user
</Files>
Thanks for the help! _________________ "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo VP, 1989 |
|
Back to top |
|
|
elgato319 Guru
Joined: 15 Sep 2005 Posts: 546
|
Posted: Tue May 20, 2008 6:13 am Post subject: |
|
|
I don't think this is a new feature from apache2. Glad you could get it working
http://httpd.apache.org/docs/2.2/en/mod/core.html#files
Quote: |
Note that <Files> can be nested inside <Directory> sections to restrict the portion of the filesystem they apply to.
|
|
|
Back to top |
|
|
quart n00b
Joined: 14 May 2005 Posts: 6
|
Posted: Tue May 20, 2008 7:20 am Post subject: |
|
|
elgato319 wrote: | I don't think this is a new feature from apache2. Glad you could get it working
http://httpd.apache.org/docs/2.2/en/mod/core.html#files
Quote: |
Note that <Files> can be nested inside <Directory> sections to restrict the portion of the filesystem they apply to.
|
|
Yeah I know, I was just my own fault ... Thanks for your help anyways, much appreciated! _________________ "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo VP, 1989 |
|
Back to top |
|
|
|