chmod
- change file mode bits.
It is very important you understand the Linux file permissions before changing mode bits.
Syntax
1 2
| chmod [OPTION] MODE FILE chmod [OPTION] OCTAL-MODE FILE
|
You can use symbolic mode here
1
| [ugoa...][[+-=][perms...]...]
|
here
- u = user
- g = group
- o = other
- a = all
Options
option |
description |
-R, –recursive |
change files and directories recursively |
–reference=RFILE |
use RFILE’s mode instead of MODE values |
-v, –verbose |
verbose mode |
Example
Add execute permission to owner
Remove execute permission from owner
Add write permission for all
Set owner’s permission to be execute only
Set permission for owner, group
users has read,write, execute permission, group has read write permission, others
Remove write permission from owner for a directory
add -R option for change files and directories recursively
Set permission using octal digits
set read permission only for all
set read,write permission for owner and read permission for group
Reference