http://www.math.jhu.edu/~userid
The convention is to name the first file /home/userid/public_html/index.html so people can use the shorter address http://www.math.jhu.edu/~userid. Otherwise they'll have to use http://www.math.jhu.edu/~userid/something.html to specify a page, which is a bother. It is customary to use an index.html file in each directory in your public_html tree to act as a kind of welcome page or ... well, index to the contents of that directory.
ls -ld public_html
(The "d" option indicates we want the information about the
directory
itself, not its contents.)
The output would be something like
drwx--x--x 14 gwbush 1024 Mar 2 2001 public_html
with the first field indicating the permissions. The last three
characters in this field (--x) are the "world" permissions which
in
this case indicate that the world has no read (-) and no write (-)
permissions for this directory, but does have access permission (x).
This means that the world may open the directory to open its
contents, even though it cannot list (read) or add or delete (write)
files in that directory.
Consider now a subdirectory "course" in public_html. We want to look at a listing of its contents. Suppose the
output of the command (note no "d" option this time)
ls -l public_html
is this:
drwx--x--x 14 gwbush 1024 Mar 8 2001 course
The permissions are the same as for the public_html directory
explained above. To see what happens inside the "course"
directory,
we try (again from the home directory)
ls -l public_html/course
whose output might look like this:
-rw-r--r-- 1 gwbush 1767 Jan 4 2000 index.html
-rw-r--r-- 1 gwbush 8048 Dec 6 1999 syllabus.html
-rw------- 1 gwbush 1254 Feb 7 2000 secret_exam_solutions.tex
Here, the world permissions are r-- for both index.html and
syllabus.html; both of these files are world readable and have a
clear access path to them all the way down, and so would be able to
be viewed by a browser. However, secret_exam_solutions.tex has --- as
its world permissions, so it is not accessible to the world (in fact,
cannot be read by anyone but the owner).
We recommend that any directory which does not need to be
listed over the web be given permissions rwx--x--x and any file which
does need to be read over the web rw-r--r--. These can be assigned by
the commands
chmod 711 <put the directory name here>
and
chmod 644 <put the filename here>
respectively. To create a directory, like an archive of html files, whose contents you would like to list, you should use the command
chmod 755 <put the directory name here>
This adds read permissions, making the permission string rwxr-xr-x. If you do this, you must not have a file named index.html in the directory, as the web daemon will send the contents of the index.html file back to the browser if the directory is asked for. If there is no index.html file and the world read permissions are set, then a listing of the directory will be sent instead.