Home Page : Glossary : "C" : Chmod
For full details on how to use chmod consult the Unix man pages. The following is intended as a summary:
The syntax for using chmod is as follows:
chmod switches mode file
Where switches can be any of:
| -R --recursive |
Recursive. Change the mode of the directories as well as the files. |
| -P --physical --nofollow |
Do not follow symbolic links. |
| -f --quiet --silent |
Do not display any messages. |
| -h --symlink |
For symbolic links, change the mode of the link |
| -v --verbose |
Show all files and changes. |
The mode indicates file permissions for the owner, group and all users. These can either be expressed using a number or symbolically.
As a number, it appears as a three digit octal number. The first digit specifying the owner permissions, the second group permissions and the final digit all user (i.e. world) permissions. Where each digit is made up of any combination of the following binary flags:
| Flag | Meaning |
| 4 | Allow read |
| 2 | Allow write |
| 1 | Allow execute (for scripts and programs) |
Thus the 8 possible values for each digit are:
| Digit | Meaning |
| 0 | Deny all |
| 1 | Execute only (no read or write permissions) |
| 2 | Write only. |
| 3 | Write or execute (but not read) |
| 4 | Read only. |
| 5 | Read and execute. |
| 6 | Read and write. |
| 7 | Allow all. |
So to grant the owner full access, members of the group read and execute and all other users execute only, would be:
chmod 751 file
Relevant links:
Can you add to this definition? If so please Report an Observation. Do you know of a relevant link to add under this definition? If so please Add a Link.
© Copyright 2004-2009, A B Cryer, All rights reserved.