How can I prevent external users from somehow getting a list of files that are on my machine?

For instance, My website is in folder /htdocs/ and I have some other random documents in there too.

How do I make sure that the user can only see the site and can never get an overview of what files I have on that harddrive?

link|improve this question
Seems like a ServerFault question to me – David Zaslavsky Jun 7 '09 at 0:42
feedback

3 Answers

up vote 6 down vote accepted

With Apache, you can create a .htaccess file like this:

 Options -Indexes

For more details, check out How to Prevent a Directory Listing of Your Website with .htaccess

link|improve this answer
1  
+1 good answer :) – David Pashley Jun 7 '09 at 7:25
feedback

assuming apache look at this page for some good security tips

in specific add to httpd.conf

<Directory />
     Order Deny,Allow
     Deny from all
 </Directory>

<Directory /htdocs>
     Order Deny,Allow
     Allow from all
 </Directory>
link|improve this answer
Directory entries very much like these are default, but it's a good idea to check to make sure. +1 – Matt Simmons Jun 7 '09 at 1:37
feedback

Also, you could restrict the apache user via SELinux policy. If you are on a system with SELinux that is...

Look at his article on secure containers (lightweight virtual machines). Perhaps for the more paranoid or those who have problems of scale.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.