Search

Using the CHMOD command effectively



Can’t remember how to calculate which CHMOD command you want to use. Below you will find every possible CHMOD command and the file permissions they will set.  Along with a simple explanation, every possible combination is listed below.
The permission mode is computed by adding up the following values for the user, the file group, and for everyone else.
  • Read 4 – Allowed to read files
  • Write 2 – Allowed to write/modify files
  • eXecute1 – Read/write/delete/modify/directory

Example 1:
user
group
world
r+w
r

4+2+0
4+0+0
0+0+0
= 640
Example 2:
user
group
world
r+w+x
w+x
x
4+2+1
0+2+1
0+0+1
= 731
Now some explanations:
Mode
Str Perms
Explanation
0477
-r–rwxrwx
owner has read only (4), other and group has rwx (7)
0677
-rw-rwxrwx
owner has rw only(6), other and group has rwx (7)
0444
-r–r–r–
all have read only (4)
0666
-rw-rw-rw-
all have rw only (6)
0400
-r——–
owner has read only(4), group and others have no permission(0)
0600
-rw——-
owner has rw only, group and others have no permission
0470
-r–rwx—
owner has read only, group has rwx, others have no permission
0407
-r—–rwx
owner has read only, other has rwx, group has no permission
0670
-rw-rwx—
owner has rw only, group has rwx, others have no permission
0607
-rw—-rwx
owner has rw only, group has no permission and others have rwx