3.7 File Maintenance Commands
Each of the permission types is represented by either a numeric equivalent:
read=4, write=2, execute=1
or a single letter:
read=r, write=w, execute=x
A permission of 4 or r would specify read permissions. If the permissions desired are read and write, the 4 (representing read) and the 2 (representing write) are added together to make a permission of 6. Therefore, a permission setting of 6 would allow read and write permissions.
Alternatively, you could use symbolic notation which uses the one letter representation for who and for the permissions and an operator, where the operator can be:
+ add permissions
- remove permissions
= set permissions
So to set read and write for the owner we could use "u=rw" in symbolic notation.
where nnn are the three numbers representing user, group, and other permissions, who is any of u, g, o, or a (all) and perm is any of r, w, x. In symbolic notation you can separate permission specifications by commas, as shown in the example below.
-f force (no error message is generated if the change is unsuccessful)
-R recursively descend through the directory structure and change the modes
If the permission desired for file1 is user: read, write, execute, group: read, execute, other: read, execute, the command to use would be
chmod 755 file1
Reminder: When giving permissions to group and other to use a file, it is necessary to allow at least execute permission to the directories for the path in which the file is located. The easiest way to do this is to be in the directory for which permissions need to be granted:
chmod 711 .
where the dot (.) indicates this directory.