You are on page 1of 4

APACHE FILE PERMISSIONS

You and any other users can access files in three ways:

read - You do this when you look or display a file on your screen. write - You do this when you edit or change a file in some way or even delete it. execute - Some files are actually sets of instructions (programs) for the computer. Although very few, if any, of the files in a web directory area will be programs, it is good to give yourself and others execute privileges.

Users There are three types of users that can access files:

owner - the owner of the file. group - a member of a group to which the owner belongs. This is an electronic group, and on the AgServer may be your department or a special group set up for working on the web site. other - everyone else with an account on the AgServer

Nine Ways Three types of users accessing a file in three different ways equals a total of nine possible ways to access a plain file!!! OR NINE POSSIBLE PERMISSIONS ON ACCESSING A FILE! read from the file write to the file execute the file read from the file write to the file execute the file read from the file write to the file execute the file

The owner of a file can:

A member of the owner's group can:

Anyone else can:

What is the permission for a file/directory? Now that you understand the many ways a file can be accessed, how do you know what the permissions are? Simply put, permissions are who and how the file can be accessed. To gain a better understanding of permissions you need to list the current files in a directory.

From a Unix prompt, enter dir The resulting directory displayed shows several columns of information, such as this:
-rwxr-xr--rwxrwxr-x drwxr-xr-x drwxr-xr-x 1 1 4 2 caldwell ffolinda rcasler ffolinda ecat ecat ecat ecat 21678 3128 512 512 Sep 13 09:27 internetguide.html Dec 31 09:19 people.html Dec 16 17:07 pubs/ Jan 2 08:56 web/

The permission explanation is the left most column. The owner name is in the middle of the display (the AgServer account logon name) and the group name follows the owner's name. For the above file named internetguide.html, the permissions are: -rwxr-xr-Permissions are set by the characters in the following way: r w x the capability to read a file the capability to write/edit/delete a file. the capability to execute a file or search a directory. No capability to access file.

A d at the left most position indicates a directory area; a - at the left most position indicates a file. the next three letters indicate the permissions for the owner
-rwxr-xr--rwxr-xr--rwxrwxr-read/write/execute for owner read/execute for group read for world

the middle three letters indicate the permissions for the group the last three letters indicate the permissions for the world Changing Permissions To change the file permissions, you need to be at a Unix prompt in the directory with the file(s) to be changed. Type the command chmod, a space, three numbers, another space, and then the name of the file you wish to change permissions for, followed by an [Enter]. The command would look something like this: chmod 744 filename The three numbers determine the permissions. The first number sets the permissions for the owner, the second for the group, and the last for everyone else. The numbers can range from 0 to 7. Below is an explanation of each number: 0 --File can't be read, written to, or executed.

1 2 3 4 5 6 7

--x -w-wx r-r-x rwrwx

File can only be executed. File can only be written to. File can be written to and executed. File can only be read. File can be read and executed. File can be read and written to. File can be read, written to, and executed.

Notice that these numbers (and their corresponding values) can be calculated by adding the 1 (x), 2 (w), and 4's (r) values together to generate any value from 1-7. So, in the example above: chmod 744 filename would change the file's permissions to -rwxr--r-Here are a few more examples of commonly used permission settings: Owner's Permissions Directories 775 drwxrwxr-x Read Write Execute Read Write Execute Read Write Execute Read Write Execute Files 664 -rw-rw-r-Read Write Read Write Read Read Write Execute Read Read Execute Group's Permissions Other's Permissions

###

String

744

drwxr--r--

Read

755

drwxr-xr-x

Read Execute

Read Execute

711

drwx--x--x

Execute

Execute

775

-rwxrwxr-x

Read Write Execute Read Write Execute Read Write Execute

Read Write Execute Read Execute

Read Execute Read Execute

755

-rwxr-xr-x

744

-rwxr--r--

Read

Read

You might also like