Fog Creek Software
Discussion Board




CHMOD and Web Server Question

Is it possible to use CHMOD to protect a directory on a web server that doesn't have an index file, so that it causes a 403 error instead of displaying the default Apache directory listing? The catch is that I still want to be able to link to files contained within the directory from other pages. I don't have access to any of the Apache configuration files.

Thanks in anticipation.

John Topley
Friday, May 30, 2003

What do you mean you don't have access to any of the Apache configuration files? The file would be ".htaccess", in the folder itself, with just a couple lines of text. You can't upload files to your space, but you can run chmod? That would be pretty odd if true...

Brad Wilson (dotnetguy.techieswithcats.com)
Friday, May 30, 2003

Sorry Brad, a major misunderstanding on my part! So what do I need to put in .htaccess?

Thanks.

John Topley
Friday, May 30, 2003

<Directory />
  Options -Indexes
</Directory>

Off the top of my head, you might want to check once over on http://www.apache.org/docs

Andrew Hurst
Friday, May 30, 2003

fc.

Thanks everyone.

John Topley
Friday, May 30, 2003

Not as fancy as modifying htaccess, but you can put this in an index.html file in the directory in question:

<html><body>Access Denied</body></html>

Even better, that works in all webservers.

Chas
Saturday, May 31, 2003

Chas - it works on all servers, but you have to pre-identify all your exposed folders.

OTOH it's the easiest one to implement.

www.MarkTAW.com
Monday, June 02, 2003

*  Recent Topics

*  Fog Creek Home