You can set and change permissions on the files in your personal web site.
The permissions on files determine who can read, write and execute the files.
- 'Read' permission allows the file to be viewed in a browser
- 'Write' permission allows specified others to edit the html file
- 'Execute' permission allows executable programs and commands to be run (this is not always relevant to html files unless they contain cgi scripts, downloadable software or multimedia applications)
You must make sure that the directories containing your web files have execute permission on them, otherwise the web server will not be able to read your home page.
Ownership of files
Personal home page files are owned by an individual who controls access to the files and directories. Central files are generally owned by the information service (ie owner = "info") but are sometimes owned by individuals.
It may be desirable for individuals other than the owner to be able to edit files. This can be done by giving 'write' permission to a defined group of users. New groups can be created and changes made to existing groups by using the UNIX groups tool.
When to set permissions
- Files or directories that don't have group or public 'read' permission can be read only by the owner of the file.
- If you do not want others to read your html files (eg, while they are being edited, backup copies, etc) you can store them in another directory, or remove the 'read' permission for the group or for others.
- If you don't want others to be able to change or run your files, you should ensure that 'write' and 'execute' permissions are not set.
- Except when editing by hand in UNIX, every time you save a file (whether it has been edited or not) the permissions are automatically changed to owner read/write/execute only.
Setting the permissions in UNIX
In the appropriate directory, use the ls (list) command to look at the permissions currently set for a particular file:
or, for all files in the current directory:
For most of your html files (ie those you want WWW browsers to be able to access) the permissions should look like this:
So, if a particular file has no access to anyone except you, the owner (ie -rwx------ , you will need to use the chmod command as follows:
chmod go+r filename
To do the same for all the html files in the current directory, use:
chmod go+r *.htm or chmod go+r *.html
When members of a group need to edit a file, give them 'write' permission by:
chmod g+w filename
NB: Using this method, permissions for only one file or directory folder can be set at a time. If you want to set the permissions on several files simultaneously, you will need to use UNIX commands (as above).
For more UNIX commands see Webmonkey's UNIX Reference Guide.