Publishing a web page using SCP/SFTP
New accounts on Educ.jmu.edu will be ready to publish upon creation, while some older accounts or accounts which some individuals may have altered, might need any or all of the following steps completed, in order to make files accessible to the World-Wide Web:
- Check that the file protection on your login directory grants
execute access to the world. If not, change the mod to allow access
using the command:
chmod o+x ~
Note that the ~ character instructs unix to use the home directory. - Create a subdirectory WWW in your home directory. Be sure you
use CAPITAL LETTERS for the directory name! You do so
with the commands:
mkdir ~/WWW chmod o+rx ~/WWW
- Create or move the web files via SCP/SFTP (secure shell or secure ftp) into that subdirectory.
- Use the chmod command to make all the files in your WWW
directory readable. If this is not done, the server program
will not be able to access the file when a user requests it.
chmod o+r ~/WWW/<filename>
More advanced features of the server program do provide methods for specifying that certain files are accessible only to certain designated hosts, but this is not the common approach. Usually files are made available to anyone who wishes to read them. - Your intended readers must be told how to access your file(s). The
standard approach is to create one file named index.html which
serves as a table of contents to other files by describing them and
embedding hypertext anchors that contain references to the files you
want to direct your readers to. This way they only need to specify
the URL for your homepage, and from there follow your links.
The server will look for the file named index.html by default if no filename is given, so you can direct your readers to use the URL: http://educ.jmu.edu/~jrsmith/ , where you replace 'jrsmith' with your own username.
Any file in your WWW directory can be referred to with the URL http://educ.jmu.edu/~jrsmith/<filename> where you replace 'jrsmith' with your own username. - You may choose to create subdirectories under your WWW directory
to contain various groups of files. If you have a directory WWW/sub1
containing a file foo.html then the URL for it would be
http://educ.jmu.edu/~jrsmith/sub1/foo.html
- Especially if you are developing Web pages that you hope will eventually
be moved to another server or directory, be sure to use the relative form
of href= rather than the full directory form. The difference is discussed
in the Beginner's Guide.