Click here to go back to the LMi.net home page Your Local Internet Service Provider; Delivering consulting and connectivity since 1992 May-17-2008
12:50 AM
Click here to see a live picture of Berkeley and San Francisco Bay

[Home] :: [Support]

File Permissions: A Guide for the Uninitiated

Are you getting a file permissions error when you try to execute a script on your Web server? Here's a handy guide that explains how to change file permissions and how to set them for scripts.

Here's how it works: A script must be "executable" in order for it to be able to run. To make it executable you have to change the permissions of the file. You need to Telnet to the Web server, and go to the directory where the script is (probably /usr/home/your-login/www/cgi-bin). If you type:
ls -l
at the prompt you will see the list of files in the cgi-bin directory and on the left side it shows the permissions for each of the files, i.e. for FormMail.pl it might show:
-rw-r--r--  1 joeblow  users  24261 Nov 17 18:59 FormMail.pl
Permissions (on the far left) are like this:
  1  2  3
-rwxrwxrwx
Column 1 is for the owner of the file (joeblow)
Column 2 is for the other members of the file's group (users)
Column 3 is for all others

r means readable
w means writable
x means executable

read (r) = 4
write (w) = 2
execute (x) = 1

So...
rwx = 7 (4 + 2 + 1)
r-x = 5 (4 + 1)
rw- = 6 (4 + 2)
r-- = 4 (4)

To change file permissions you use the command called chmod (it means "change mode"). The syntax of the command is:
chmod <number> <filename>
i.e. To change the file permissions for the file called "textfile.txt" to
Readable, writable, executable by the owner (7)
Readable, executable by the group (5)
Readable by everyone else (4)
type:
chmod 754 textfile.txt
Scripts are usually set to 755:

Readable, writable, executable by the owner (7)
Readable, executable by the group (5)
Readable, executable by everyone else (5)

So if you are trying to run the FormMail.pl script you'd need to type:
chmod 755 FormMail.pl
to get it to become:
-rwxr-xr-x  1 joeblow  users  24261 Nov 17 18:59 FormMail.pl
If you are still getting errors after changing your file permissions, contact us for support anytime.

 

Go to the LMi.net home page
Get business information about LMi.net
Information about LMi.net's Internet and Consulting services
Support for LMi.net customers
Access email via a web interface
Learn about LMi.net's network status
Links to fun and useful sites about Berkeley
A complete index of all the pages on this web site
1700 Martin Luther King Jr. Way, Berkeley, CA 94709, +1-510-843-6389 (ph), +1-510-843-6390 (fax)


Web lmi.net
[Home] [Services] [Support] [About] [Berkeley!] [Site Map] [Webmail]
© 2008 by LMi.net. All Rights Reserved.