Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Restrict Directory by httpd file?

Status
Not open for further replies.

rxsid

Programmer
Jul 9, 2002
57
0
0
US
Hi All,

I'm running apache 2.0.52 on a windows 2003 server. I'd like to restrict a directory when access via a browser.
With IIS, I could set directory security on the virtual site to require authentication via a popup box.

1. Is there something similar when using apache? (require authentication to be typed into a popup box).
2. I don't want to use .htaccess files to restrict directories, I wan't to use the httpd.conf file, but not sure how to secure say with being the root web directory.

Something like:
Code:
<Directory /[URL unfurl="true"]wwwroot/privateDir>[/URL]
  What would go here to cause a popup authentication for this directory?
</Directory>


Thank you.
 
thanks for the reply.

this is what i tried:
Code:
<Directory /[URL unfurl="true"]wwwroot/privateDir>[/URL]
AuthType Basic
AuthName "Restricted Files"
AuthUserFile F:/Apache2/var/somepwdfile
Require user someuser
</Directory>
i created the somepwdfile using the htpasswd.exe that came with apache, and tried both with the password SHA encrypted and plain text. i stopped, restarted apache...and still i'm getting the forbidden error:
Code:
Forbidden
You don't have permission to access /privateDir/ on this server.
did i miss a step?
 
rxsid,

Since this is a Windows Server 2003 box, your <Directory> container and the path to the AuthUserFile needs to have the path specified as a Windows-style path.

Try changing <Directory / to
<Directory F:\path\to\privateDir> and change
AuthUserFile F:/Apache2/var/somepwdfile to
AuthUserFile F:\path\to\somepwdfile



Wishdiak
A+, Network+, Security+, MCSA 2003 certified
 
ok...i got it.

i just didn't have the full path name
Code:
<Directory F:fullPathto/[URL unfurl="true"]wwwroot/privateDir>[/URL]
 
how ironic...looks like we were posting at the same time.

the only issue was my missing full path name in the <DIRECTORY> line as i indicated...the other with forward slashes is correct.

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top