Three bits per digit
A three-bit group has eight possible patterns: 000 through 111. One octal digit identifies each pattern.
Base-8
Octal uses the digits 0–7. Each digit represents three binary bits, which makes it a useful way to read and set file permissions.
Jump to the permissions calculator ↓Before starting, work through binary place values.
A three-bit group has eight possible patterns: 000 through 111. One octal digit identifies each pattern.
Linux ordinary permissions use three bits for each of owner, group, and others: read, write, and execute.
The chmod command accepts numeric modes in octal. Reading 640 is easier once you can explain each group of bits.
The digits 8 and 9 are not valid in octal. After 7 comes 108, which is eight in decimal. The subscript labels the base; it is not part of the number.
Count positions from zero on the right. Each step left multiplies the weight by eight; the next position after 64 is 512.
8 to the power of 2
Weight:64
7 × 64 = 448
8 to the power of 1
Weight:8
5 × 8 = 40
8 to the power of 0
Weight:1
5 × 1 = 5
7558
7 × 64 + 5 × 8 + 5 × 1
448 + 40 + 5 = 49310
The value stays the same when its base changes. For a permission command, keep the octal digits: chmod 755 uses octal mode 755, not decimal 755.
Starting from the right, split the bits into groups of three. Add zeros on the left of the first group if needed; leading zeros do not change the value. Within each group, the weights are 4, 2, and 1.
| Binary | Sum | Octal |
|---|---|---|
| 000 | 0 + 0 + 0 | 0 |
| 001 | 0 + 0 + 1 | 1 |
| 010 | 0 + 2 + 0 | 2 |
| 011 | 0 + 2 + 1 | 3 |
| 100 | 4 + 0 + 0 | 4 |
| 101 | 4 + 0 + 1 | 5 |
| 110 | 4 + 2 + 0 | 6 |
| 111 | 4 + 2 + 1 | 7 |
111 101 1012 = 7558
Ordinary permissions use nine bits. They can represent values above the eight-bit byte limit of 255. The three groups describe three different permission classes.
The first digit describes the owner, the second the group, and the third everyone else. In each group, read is worth 4, write is worth 2, and execute is worth 1. A dash means that bit is off.
rwx
1112
4 + 2 + 1 = 7
r-x
1012
4 + 0 + 1 = 5
r-x
1012
4 + 0 + 1 = 5
For a regular file, read concerns its contents, write concerns changing those contents, and execute permits execution. For a directory, read lists entry names and execute allows search/traversal; write with execute allows changes to entries. The files inside retain their own permissions. A directory mode does not automatically make its files executable.
A mode such as 644 is an example for a file intended to be readable by others; 600 is an example for a private file. Choose according to the required access. Special bits, ACLs, and other controls are covered in the Linux permissions lesson.
Three bits make one octal digit
Read is 4, write is 2, and execute/search is 1. Add the enabled bits within each class, then write the digits in owner, group, others order. This preview does not change any files.
Exactly three digits from 0 to 7, including any leading zeros. Special four-digit modes are taught separately.
Try a mode
chmod 644 ./permission-practice.txt
Copying does not execute this command. If you practise in a terminal, use only a disposable file you own at the example path. The command changes that item's mode; it does not create the item.
For a regular file, read (r) allows reading its contents, write (w) allows changing its contents, and execute (x) permits execution when the file and environment support it. An execute bit does not turn arbitrary text into a program. Access also needs search permission along the path; deleting a file is governed by its parent directory.
This calculator covers the nine ordinary mode bits. The applicable owner, group, or others class is used; permissions are not simply added across all three classes. ACLs, privileges, filesystem rules, and other controls can affect actual access. Special bits and their preservation rules are outside this preview.
Use the ordinary mode bits only. Assume no additional ACLs or special bits; changing a directory mode does not change its children.
The owner can read and write a file. The group can only read it. Others have no permission, and nobody needs execute permission. What ordinary mode expresses this?
Owner: read + write. Group: read. Others: no bits. Add 4, 2, and 1 only when the corresponding permission is needed.
The owner can list, traverse, and change directory entries. The group can list and traverse, but cannot change entries. Others have no permission. Which ordinary mode fits?
For a directory, read lists names, search (x) permits traversal, and changing entries needs write plus search.
The directory owner has rwx. Group and others may traverse the directory to reach a known filename, but may not list names or change entries. Which ordinary mode fits?
Group and others need only the search bit, x. Reading a file also depends on that file's permissions and the rest of its path.
References: GNU numeric modes, GNU permission meanings, and GNU file permissions.
Use a Linux shell for this short lab. Predict the permission strings for a file with mode 640 and a directory with mode 750. Then copy the complete block: it creates a fresh temporary folder, sets the two modes, and prints their actual permissions. If folder creation fails, the file operations do not run.
Create, set, and inspect isolated practice files · Shell
if practice_dir=$(mktemp -d) && [ -n "$practice_dir" ] && [ -d "$practice_dir" ]; then
printf 'Practice folder: %s\n' "$practice_dir"
printf 'Course practice only\n' > "$practice_dir/notes.txt" &&
mkdir "$practice_dir/team" &&
chmod 640 "$practice_dir/notes.txt" &&
ls -l "$practice_dir/notes.txt" &&
chmod 750 "$practice_dir/team" &&
ls -ld "$practice_dir/team"
else
printf 'Could not create the practice folder; no file modes changed.\n' >&2
fiThe file permission field begins -rw-r-----; the directory field begins drwxr-x---. The first character is the file type and is separate from the nine ordinary permission bits. Some systems show an additional marker after the permissions, such as an ACL indicator.
Record the octal mode and each binary group. Explain which bits permit group traversal when every parent directory also allows it. The temporary parent is private, so this exercise demonstrates mode strings; it does not grant other users access through that parent. Account privileges and any additional access controls also affect effective access.
Try these without the converter or reference table. Check each answer to reveal its explanation.