File Permissions
The chmod
command is used to control the access permissions for directories. We can use the octal notation to set permissions. To describe the octal notation, we can add permission values to obtain new, combined (octal) values.
Permission values:
1 – able to execute (x)
2 – able to write (w)
4 – able to read (r)
The octal number is the sum of the permission values, for example:
3 (1+2) – able to execute and write
6 (2+4) – able to write and read
The meaning of the r, w, and x attributes is different:
r - Allows the contents of the directory to be listed if the x attribute is also set.
w - Allows files within the directory to be created, deleted, or renamed if the x attribute is also set.
x - Allows a directory to be entered (i.e.
cd dir
).
There are three digits in a chmod
permission. The first digit represents the permissions of the user, the second represents the group, and the third represents global permissions. So if a file has permissions 754
, the user can read, write, and execute; the group can read and execute, while all other users can only read.
Permissions my be interpreted and set numerically (640) or symbolically (wr-).
Permission 600
is a common setting for data files that the owner wants to keep private. The owner may read and write a file. All others have no rights.
600
is equivalent to rw-------
.
If you have another setting configured for your private data file, please run the chmod
command to set it to 600
.
This table covers the common settings, those beginning with "7" are typically used with programs (since they enable execution) and the rest are for other kinds of files.
Here are some useful settings for directories:
Last updated