Linux server: what controls direct access to directories?

By which I mean: with my old server, I could create a directory named whatever, “janefolder”, then put things in it, and email my friend and tell her that files were there for her, go to http:/www.stoidsite.com/janefolder and she would get some generic auto-generated page that would have a few lines on top that said something like

**Contents of Janefolder
**
Janefile.zip
janefile.jpg
stoidsfileforjane.html

and those would be active links.

But on my new server, the one I have to pretend I know how to admin, when I create /janefolder/ and try to access it via HTTP, I get a page that says:

*Forbidden

You do not have permission to access this document. * *
Web Server at stoidsite.com *

Now, I just went through making some changes to the notfound.html document in the errordocs directory (permissions! GODDAMN PERMISSIONS! CHMOD THIS! GO CHOWN YOURSELF!) to rescue a lot of lost traffic, so I recognize where this page likely resides and I know I could change this actual page to something different.

But what controls the page in the first place? Where is the command center that says: “if someone tries to access a directory, vs. a page, throw this page in their face” I would like, if possible, to be able to have it work the way it used to, with automatically generated listings of he directory. I am aware that it’s a bit of a security thing, so maybe I won’t actually follow through in the end, but I would like to make that decision with an understanding of how it works. (We used to just throw up index pages in any directories that didn’t have them that were either blank or said something like “shoo! You don’t belong!”)

Well, it does depend on your server and where your directory is.

Assuming that you are running Apache, the file that configures directories is called httpd.conf, and will be found in /etc or some directory off /etc (like /etc/httpd). In this file you can define all your virtual directories, and configure things like file browsing.

Also, you could make things work by identifying the www root directory. Directories created below this point can be directly accessed in the way you want. However, you need to check permissions, as the directory you create has to be readable by the web server user (usually www).

Also, some elements of the webserver can be configured by a .htaccess file, that sets per directory options. Use the documentation on the Apache website for a guide.

Si

On Apache, the files need to be readable by whatever user the apache server is running as, using the standard file system permissions. For auto-generated directory indexes, the directory also needs to be readable and executable for that user.

You also need to set the “Indexes” option for that directory (or any of its parents) in the apache configuration. If you’ve got .htaccess files enabled, you can just put an .htaccess file in the directory containing the line


Options +Indexes