Changing WWW File Permissions
The Computing Science and Mathematics Department has its own web server:-
www.cs.stir.ac.uk
In order to put your own files on the web server, you need to put them in the www directory in your Unix filestore (visible as the H: drive from Windows). This page tells you how to change the file permissions so that the web server will retrieve your web pages for anyone who wants to view them.
To set the file permissions correctly:
- 1. Place your file in the www directory
- Do this by saving/copying/moving it to the www directory on your H: drive.
- 2. Login to Unix
- Use the PuTTY program and enter your username and password.
- 3. Change directory to www
- Do this by typing cd www and pressing Return
- 4. Check that the file is there
- Enter the command ls -al and press Return.
You should see something like (if your file was hello.html)
total 8 drwx--x--x 2 xyz 512 Sep 17 16:01 . drwx--x--x 5 xyz 1536 Sep 17 15:47 .. -rw------- 1 xyz 19 Sep 17 16:01 hello.html
The information at the right gives the file names, the information at the left gives the file permissions. For example, we have that ".", the current directory, has file permissions drwx--x--x. The "d" means directory, the next three characters "rwx" means that you have read, write and execute permission. The next three characters "--x" refer to others of your group and the final three refer to everyone else. As you can see in this example, members of your group and others have execute permission but no read/write permission, as the "-" means no permission given. Looking at hello.html, the example above shows that you have read/write permission, but noone else can read/write/execute your file. - 5. Make your file readable
- Enter chmod a+r hello.html (or whatever your filename is) and press Return. The "a" stands for "all", the "+" stands for adding permission, and the "r" stands for read, so you are adding read permission for all to that file. Note that if you have a number of files in the directory and you want to make all of them readable, then a shortcut is chmod a+r * and the "*" stands for all files.
- 6. Check that your file is web-accessible
- Load up your favourite browser and open the URL
http://www.cs.stir.ac.uk/~xyz/hello.html
where you should substitute your own username for the "xyz" and your own file name for the "hello.html". Hopefully you can now see your file and all is well. If not, do a "ls -al" command again and check the file permissions.