How to change file/directory permission in Linux
How to change file/directory permission in Linux
chmod
chmod (change file mode bits) command allows you to change file access and directory. File permissions are given to users, groups, and other users.
SYNOPSIS
chmod [OPTION]… MODE[,MODE]… FILE…
chmod [OPTION]… OCTAL-MODE FILE…
chmod [OPTION]… –reference=RFILE FILE…
Number | Permission Type | Symbol |
---|---|---|
0 | No Permission | — |
1 | Execute | –x |
2 | Write | -w- |
3 | Execute + Write | -wx |
4 | Read | r– |
5 | Read + Execute | r-x |
6 | Read +Write | rw- |
7 | Read + Write +Execute | rwx |
Example
ls -alt
chmod 066 SMTPTester.py
chmod 777 SMTPTester.py
chgrp
chgrp (change group ownership) command is used to change the group to which a file or directory belongs. This is an administrator command. Only administrator users can change the group to which the file or directory belongs.
SYNOPSIS
chgrp [OPTION]… GROUP FILE…
chgrp [OPTION]… –reference=RFILE FILE…