The chmod command allows you to change the read, write, and execute permission on a file or directory. Permissions determine who can use which file and how they can use it.
There are three types of permissions,
r = read
w = write
x = execute
Read permission lets you look at a file or directory. You can use cat or a text editor to see what is in a file that has read permission; you can also copy this file. Read permission for a directory lets you list the directory's contents.
Write permission lets you make changes to a file. Even if you can write (change) a file, you can't necessarily delete or rename it; for these actions you must be able to write in the directory in which the file resides. If you have write permission in a directory, you can create and delete files in that directory.
Execute permission lets you run the program contained in the file. The program can be a real program or a shell script. (If the file doesn't contain a program, execute permission doesn't do much good and can provoke the shell to complain bitterly as it tries to make sense of your file.) For a directory, execute permission lets you open files in the directory and use cd to get to the directory and make it your working directory.
The see the permissions on a file use ls with the -l option.
Example: ls -l filename
You will see something like -rw-r--r-- The first symbol is a (-) hyphen if it is a file, and l if it is a symbolic link, and a d if it is a directory. The next three characters determine if the 'owner' can read, write, or execute. The next three characters determine the read, write, and execute permission of the group. In the example above, the group has read permission only. The last three characters determine if everyone else (sometimes read as the world or others) can read, write, or execute the file or directory listed. In the example above the world has read permission only.
chmod a+r filename
(all plus read - gives read permission to everyone)
chmod go -xw filename
(group and others minus execute and write - takes away write and execute permission from the group and others)
chmod go +xw filename
(group and others add execute and write - adds write and execute permission for the group and others)
Permissions can also be changed by number. Numbered permissions are called absolute permissions. See the UNIX man pages for more information on how to change numbered permissions.
Levine, John R. and Margaret Levine Young. UNIX for Dummies. California: IDG Books Worldwide, Inc., 1992.