University of Minnesota Duluth
People | Departments | Search UMD
ITSS
ITSS home : Web Services : WebDev Guide

ITSS WebDev Guide

2 Creating your site : Setting file permissions

Setting file permissions

To allow people to view your web site once you have the pages in place, you must set the correct Unix file permissions (have you ever been to a web site and received the "Forbidden - You don't have permission to access ****.html on this server" message?).

However, these file permissions also allow you (and others) to edit and/or delete files. Obviously, you want to set the file permissions so that everyone can view the files in a web browser, but only you (or a group you select) can edit or delete them.

If you create the files on your personal computer and transfer them to the web server (www.d.umn.edu) using either WS_FTP or Fetch, the default file permissions are automatically set to read by everyone/edit by you. For details on using these utilities, please see Moving your files to the web server.

If you create the files in your web directory or transfer them using other utilities, you will need to use the Unix "chmod" command to set the file permissions correctly. For each file and each directory, you specify both the type of permission and the group that has the permission. You can specify the permissions in either absolute or symbolic mode.

Setting absolute permissions

Absolute mode is set using the following format:

chmod nnnn name

where "n" is a number between 0 and 7 and "name" is the name of the file or directory

  First n Second n Third n Fourth n
What is does Sets group ID Sets permissions for the owner of the file Sets permissions for the group Sets permissions for everyone else (i.e., the world)
Possible values 0 or blank 4 (read only - used for files)
5 (read/execute search - used for directories)
6 (read/write)
7 (read/write/execute search)

Checking permissions on your web site

To check your current settings, go to the directory and at a Unix prompt type:

ls -l

and press ENTER.

You'll see a listing similar to the following:

File 
permissions

Sample Permissions

Following are some common permissions you might set for your web files.

Absolute Command Unix listing Permissions
chmod 644 filename -rw-r--r-- User can read/write to file; group & all can read it
chmod 664 filename -rw-rw-r-- User & group can read/write to file; all can read it
chmod 755 dirname -rwxr-xr-x User can read/write/execute (search) directory; group & all can read/execute (search) it
chmod 775 dirname -rwxrwxr-x User & group can read/write/execute (search) directory; all can read/execute (search) it

For additional details on the chmod command, go to any Unix prompt and type the following:

man chmod 

Rev: alj 06.06

Didn't find what you were looking for?