Linux Octal and Symbolic Permissions
Full-Access Members Only
Sorry, this lesson is only available to Server Academy Full-Access members. Become a Full-Access member now and get instant access to this and many more premium courses. Click the button below and get instant access now.
Instructions
Q&A (0)
Notes (0)
Resources (0)
Saving Progress...
Resources
There are no resources for this lesson.
Notes can be saved and accessed anywhere in the course. They also double as bookmarks so you can quickly review important lesson material.
In the Linux and Unix operating systems, file permissions are a crucial aspect of security and access control. They determine who can read, write, and execute files and directories.
Try using the calculator below grant permissions to different groups, and see the resulting octal and symbolic codes that are generated:
CHMOD Calculator
Owner | Group | Others | |
---|---|---|---|
Read (4) | |||
Write (2) | |||
Execute (1) |
Octal Representation
You may notice the 644 number in the example above. The octal representation consists of three digits, each representing the permission for the owner, group, and others, respectively:
- Read (4): The ability to view the content of a file or list the contents of a directory.
- Write (2): The ability to modify or create new content within a file or directory.
- Execute (1): The ability to run or execute a file or access the contents of a directory.
So, the number used in the example above can be broken down as follows:
- Owner: 4 (read) + 2 (write) = 6
- Group: 4 (read)
- Others: 4 (read)
Symbolic Representation
In symbolic representation, permissions are denoted by a set of three characters for the owner, group, and others, respectively. Each character slot can either have a character representing a permission or a -
indicating the absence of that permission. The characters used are r
for read, w
for write, and x
for execute. Here's a breakdown:
r
(read): The ability to view the content of a file or list the contents of a directory.w
(write): The ability to modify or create new content within a file or directory.x
(execute): The ability to run or execute a file or access the contents of a directory.
The order of these characters is always the same: r
, followed by w
, followed by x
.
Example:
Consider a file with permissions for the owner to read, write, and execute, for the group to read and execute, and for others to read only. The symbolic representation would be rwxr-xr--
. Here's the breakdown:
- Owner:
rwx
(read, write, execute) - Group:
r-x
(read, execute) - Others:
r--
(read)
Converting Between Octal and Symbolic Representations:
It's important to be able to convert between octal and symbolic representations of permissions. Here's how you do it:
- For each set of permissions (owner, group, others), write down the symbolic representation (e.g.,
rwx
,r-x
,r--
). - Convert each symbolic representation to a sum of values based on the permission (e.g.,
rwx
= 4+2+1 = 7,r-x
= 4+1 = 5,r--
= 4). - Combine these individual values to get the octal representation (e.g., 755).
So, the octal 755
corresponds to the symbolic rwxr-xr--
.
Server Academy Members Only
Sorry, this lesson is only available to Server Academy Full Access members. Become a Full-Access Member now and you’ll get instant access to all of our courses.
This is the best way yet I`ve seen permissions explained.
Good work!