 |
Setting Permissions
Understanding permissions
UNIX servers enable you to set permissions using either a numeric system or a letter-based system. The following table lists and describes the three different permission levels and the corresponding letter and numeral identifiers.
|
Permission
|
Description
|
Letter
|
Numeral
|
|
Read
|
User can view the directory or file contents.
|
r
|
4
|
|
Write
|
User can modify the directory or file(s).
|
w
|
2
|
|
Execute
|
User can execute files.
|
x
|
1
|
For example, full read, write and execute permissions could be assigned using the numeral "7" or the letters "rwx."
r = 4, w=2, x=1
4 + 2 + 1 = 7
rwx = 7
This, however, is only the first step in assigning permissions; you must also account for the different user types who may attempt to access a directory or file. The following table lists the different user types:
|
User type
|
Letter
|
|
The file's user (you)
|
u
|
|
The file's group
|
g
|
|
Others
|
o
|
|
All (the user, the group and others)
|
a
|
One way to specify user permissions is to specify the exact permissions for each user type. For example, this:
u=rwx
g=rx
o=rx
Grants:
* read (r), execute (x) and write (w) access to the user (u)
* read (r) and execute (x) access to the group (g)
* read (r) and execute (x) access to others
Since there are three levels of permissions for each user type, you can also specify the permissions by using three sets of three letters. For example, the permissions specified by u=rwx,g=rx,o=rx above can also be specified by:
rwxr-xr-x
The first three characters always specify the permissions for the user, the next three characters specify the permissions for the group and the final three specify permissions for others. When a permission is denied, a dash ( - ) is used as a placeholder.
Instead of using letters, you can also specify permissions using a series of three digits, each of which is the sum of the three permission values. For example:
751 (equates to rwxr-x--x)
755 (equates to rwxr-xr-x)
Checking permissions
1. To view permissions and contents for the current directory type:
# ls -l
2. To change the directory you are currently in type:
# cd directoryname
3. To List the permissions of a single file.
# ls -l script.pl
-rw-r--r-- 1 user user 0 May 2 19:51 script.pl
Changing permissions
The /cgi-bin directory and any executable scripts requires one of the following permissions:
751 (which equates to rwxr-x--x)
755 (which equates to rwxr-xr-x)
To change permissions for a file named script.pl, you need to issue the UNIX chmod command (change mode).
For example, you type this:
1. Check current permissions.
# ls -l script.pl
-rw-r--r-- 1 user user 0 May 2 19:51 script.pl
2. Issue chmod command to change permissions.
# chmod 755 script.pl
OR
# chmod u=rwx,g=rx,o=rx script.pl
3. Check Script Permissions again:
# ls -l script.pl
-rwxr-xr-x 1 user user 0 May 2 19:51 script.pl*
Setting Permissions using Fetch for MAC:
If you have Fetch for the Mac, you have an easy way to change permissions. Go to the file you want to change the permissions on, and highlight it. Under the Remote menu, select Change Permissions.

A window will pop up showing the current permissions for the file you had highlighted, as shown in the screenshot below.
Setting Permissions using WsFTP
1. Open your FTP program and upload the files to the appropriate folders on your server. Make sure you are uploading any file that ends with .cgi, .py, or .pl in ASCII format. Binary programs, however, should be uploaded in BINARY. If you're using WSFTP then you'll see the option to switch between ASCII and BINARY or AUTO.
2. Highlight the file you need to change and right click it. Choose "chmod" and then a POP UP box will show up.
To set the file to 755, check every box except the "Write" box for the "Group" and "Other" row and hit "OK".
Back to Online Manual
|
 |
|