Reference: chmod
chmod
chmod [option]
mode files-f-R
Who
u |
|
g |
|
o |
Other |
a |
All (default) |
Opcode
Permission
r |
|
w |
Write |
x |
Execute |
s |
|
t |
|
u |
|
g |
|
o |
Other's present permission |
l |
Mandatory locking |
Note: a fourth digit may precede this sequence. This digit assigns the following modes:
4 |
Set user ID on execution |
2 |
|
1 |
Examples
chmod u+x file
chmod 751 file chmod u=rwx,g=rx,o=x file
Any one of the following assigns read-only permission to file for everyone:
chmod =r file chmod 444 file chmod a-wx,a+r file
Set the user ID, assign read-write-execute permission by owner, and assign read-execute permission by group and others:
chmod 4755 file

