You can make changes to permissions by entering a chmod command. It allows the owner of the file to add to ( +) or remove from ( -) existing permissions. It also allows the owner to clear existing permission and assign all permission from scratch; this is known as assigning permissions absolutely ( =). The chmod command affects any of the three types of access for any of the three categories of Unix users, using one-letter symbols in the following order (left to right):
u owner (user)g File's group
o all others
a all (default)
+ add permission
- remove permission
= absolute permission
r to read
w to write
x to execute
Caution: It is possible for you to lock yourself out of one of your own files with chmod. Be careful when you type it.
Example:
ls -l psab-rwxr-xr-x 1 otto rz 487 Jul 30 10:21 psab
chmod o-x psab
ls -l psab
-rwxr-xr-- 1 otto rz 487 Jul 30 10:21 psab
In the above example, the first ls -l shows the default permissions for a script, which is executable and readable by everyone, but writable only by the owner. After the chmod o-x command, the execution permission for others is removed. The file permissions can also be expressed in octal numeric form; see the man pages of chmod for details.