You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Michael Simpson <Mi...@Express.co.uk> on 2004/10/07 15:40:57 UTC

[users@httpd] password protect files

Hello.

I'm using Apache 2 and can password protect a directory with no problem.
However, I need to password protect just 1 file within a directory, not the
whole directory.

I've searched the web and Apache's website but found nothing re: just files
(only directories).

I do the authentification from within the conf file (not a seperate
.htaccess file).

Can someone tell me what's the obvious error below:

Alias /library "C:/xxx/yyy/zzz/admin.html"

  <Files "C:/xxx/yyy/zzz/admin.html">
        AuthType Basic
	AuthName "LIBRARY STAFF ONLY"
	AuthUserFile "C:/Apache2/<dir>/<filename>"
	Require user <user>
  </Files>


The following works for protecting a directory:

Alias /library "C:/xxx/yyy/zzz"

  <Directory "C:/xxx/yyy/zzz">
        AuthType Basic
	AuthName "LIBRARY STAFF ONLY"
	AuthUserFile "C:/Apache2/<dir>/<filename>"
	Require user <user>
  </Directory>

Thanks in advance.

----------------------------------------------
Michael Simpson
Systems Development
Express Newspapers
mailto:michael.simpson@express.co.uk
020-7922-7225 (w)
020-7922-7799 (f)
----------------------------------------------



The NMA: Opening Up Newspapers http://www.nmauk.co.uk

Visit Express Newspapers and OK Magazine online picture archive at
http://www.expresspictures.com/

###EXN2004###

_____________________________________________
Any views or opinions are solely those of the author 
and do not necessarily represent those of Express Newspapers
_____________________________________________
The information transmitted is intended only for the person 
or entity to which it is addressed and may contain confidential 
and/or privileged material.If you are not the intended recipient
of this message please do not read ,copy, use or disclose this 
communication and notify the sender immediately. It should be 
noted that any review, retransmission, dissemination or other 
use of, or taking action in reliance upon, this information by 
persons or entities other than the intended recipient is prohibited.
Email communications may be monitored
****************************************************************************


##EXN2000##


---------------------------------------------------------------------
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


Re: [users@httpd] password protect files

Posted by Joshua Slive <js...@gmail.com>.
On Thu, 7 Oct 2004 14:40:57 +0100, Michael Simpson
<mi...@express.co.uk> wrote:
> Hello.
> 
> I'm using Apache 2 and can password protect a directory with no problem.
> However, I need to password protect just 1 file within a directory, not the
> whole directory.
> 
> I've searched the web and Apache's website but found nothing re: just files
> (only directories).

See: http://httpd.apache.org/docs-2.0/sections.html#file-and-web
where you will find that the <Files> container takes a filename, not a
full path, but that it can be nested in a <directory> container to get
the effect that you want.

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