To see what the existing permissions on a file are, use the command ls -lg filename:
stealth% ls -lg gimprc-old -rw-r--r-- 1 ariel rad 5388 May 29 1996 gimprc-old
The owner can read and write to this file, the members of the group rad can read it, and everyone else can read it. (For more information about how to figure out the permissions, see the ls command.)
You can add permissions for u (the user, i.e. the owner), g (the group), or o (others, i.e. everyone else).
In order to add permissions, use chmod + and in order to take them away, use chmod -.
The permissions you can add are r (read), w (write), and x (execute).
Let's see how this works:
Suppose I want to add execute permissions for the members of the group in the above example. Then I use the command chmod g+x gimprc-old:
stealth% chmod g+x gimprc-old stealth% ls -l gimprc-old -rw-r-xr-- 1 ariel 5388 May 29 1996 gimprc-old
Suppose now that I want to remove read permissions for everyone (the 'other') category). Then I use the command chmod o-r gimprc-old:
stealth% chmod o-r gimprc-old stealth% ls -l gimprc-old -rw-r-x--- 1 ariel 5388 May 29 1996 gimprc-old
You can use chmod to change the permissions of all files and directories within a directory, including the directory itself, by using the command chmod -R settings directory-name where settings is [ugo][+-][rwx] and directory-name is the name of the directory you want to change.
More information about the chmod command is available by using the command man chmod.