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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable "Index of /" ?

Status
Not open for further replies.

LocoPollo

Programmer
Jun 6, 2005
48
DK
I have made a little perl script that creates some folders (and files too). It creates the folders as owner 'www' (not as my ordinary username 'hotguy' - and I guess 'apache' is set to 'The permissions are chmod to '0700' (I only want my scripts to be able to see what is in the folders - I have made a little login/password thingy)

When I login via FTP, I cant even access the folder or files with my 'hotguy' login.

However when I enter the URL for the folders in a browser, then I get a complete list of the folder that has been created - the whole world can see the content via browser!? that wasn't the meaning, it should be secret! :) maybe get a "Access denied" thingy or something.

I guess it's because apache (' owns the files and folders that are generated by the scripts, so it also shows folders that apache owns when someone ask for it.

How do I advoid this? I could just copy an empty "index.html" file into the created folders, but still it's not the "correct" way of doing it. (someone could just try with different folders and file, names until they hit the right names)

Can I somehow in the browser get a "Access denied" without having to desturb the guy who has the server? I only want the scripts to be able to see the content.
 
if you only want your scripts to see the folders, place them in a directory outside the webroot scope. That way, apache won't be able to reach them, but the scripts, internally, will. So, say your webroot is /usr/apache/webroot and your cgi files are in /usr/apache/webroot/cgi-bin. Make your secret-directory-root to be, say, /usr/secret. Now, give that folder apache ownership, so the the scripts can reach and read/write stuff inside, and have the scripts write to /usr/secret. The directory is outside apache's webroot scope and inaccessible through a browser.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top