This page lists the permissions, references and operators that can be used with the chmod Command. *Note that below are not all the possible combinations of the command.
chmod (or change mode) is a very useful tool that can be used to edit what users can do with a specific file. Although chmod can be dangerous if it is not used
correctly, below are the options that you can use with chmod. |
Permission |
Mode |
Binary Value |
Read privileges |
r |
100 |
Write privileges |
w |
010 |
Execute privileges |
x |
001 |
This table cotains the references (how to set user/group specific permissions) that will be used with chmod |
Reference |
Class |
Description |
u |
user |
Allows only the owner of the file to have certain permissions. |
g |
group |
Allows only users who are members of the file's group to have certain permissions. |
o |
others |
Allows users who are not the owner of the file or members of the group to have specific permissions. |
a |
all |
Encompasses all three of the above. |
These are chmod operators that allow the user (owner of the file) to add or take away permissions. |
Operator |
Description |
+ |
Adds the specified mode to a file or directory |
- |
Takes away the specified mode to a file or directory. |
|
Code |
Output |
chmod a+rwx
This gives all users and groups read, write and execute privileges.
|
Before:  After:
 |
chmod a-rwx
This takes away all read, write, and execute privileges for all users
|
Before:  After:
 |
chmod +r
This will give all users the ability to read the file. Using chomod a+r will do the same thing, and is considered to be the "correct" way to do it. With this said, both ways work.
It is best to use a if you want to change the permission for all of the users.
|
Before:  After:
 |
chmod a+x
This gives all users the ability to execute the file.
|
Before:  After:
 |
chomod u-x
This will only give the root or super user the ability to execute the file.
|
Before:  After:
 |