A deep dive into how chmod 755, 644, 777, and other common permission masks break down into individual binary bits — every single bit explained.
Before we dive into specific chmod values, I need to explain the underlying binary layout. Linux file permissions occupy exactly 9 bits. These 9 bits are divided into three groups of 3 bits each, with each group corresponding to a user class: owner, group, and others. Within each group, the bits represent read (high), write (middle), and execute (low).
In my years of Linux systems administration, I have found that visualizing the full 9-bit structure is the fastest way to truly understand chmod. Here is the complete bit position map:
When I started managing multiple Linux servers, I kept a cheat sheet of octal permission values on my desk. These days I can read 2775 as setgid plus rwxrwxr-x without thinking twice.
| Bit Position | Class | Permission | Octal Value | Bit Weight |
|---|---|---|---|---|
| 8 | Owner | Read (r) | 400 | 256 |
| 7 | Owner | Write (w) | 200 | 128 |
| 6 | Owner | Execute (x) | 100 | 64 |
| 5 | Group | Read (r) | 040 | 32 |
| 4 | Group | Write (w) | 020 | 16 |
| 3 | Group | Execute (x) | 010 | 8 |
| 2 | Others | Read (r) | 004 | 4 |
| 1 | Others | Write (w) | 002 | 2 |
| 0 | Others | Execute (x) | 001 | 1 |
The relationship between octal and binary is direct: each octal digit (0-7) unpacks into exactly 3 bits. This is why chmod accepts octal numbers — not because octal is inherently special, but because 3-bit groups map perfectly to the rwx triple. Decimal would not work because decimal digits do not align with 3-bit boundaries.
chmod 493 is the same permission value as 755 in octal, but 493 tells you nothing about the permission structure. The octal 755 immediately shows three independent rwx triples. This is the reason Unix chose octal for permissions — it is a deliberate design choice based on the binary architecture, not an arbitrary convention.
chmod 755 is the go-to permission for directories and executable files. In my experience, something like 70% of the permission values I set on production servers are 755 for directories and 644 for files. Let's break 755 down bit by bit.
Each bit position tells you exactly which permission is granted or denied. Let me walk through the bit analysis of 755:
The decimal value of 755 is 493 (256 + 128 + 64 + 32 + 0 + 8 + 4 + 0 + 1 = 493). But as I mentioned earlier, the decimal form is much less useful than the octal because it obscures the triple structure. When I audit server permissions, I always think in octal and binary, never decimal.
chmod 644 is the standard file permission for non-executable files. Every HTML file, every CSS stylesheet, every text configuration file you see on a typical Linux server is probably 644. The binary representation is 110100100.
Here is the key insight about 644: bit 6 (owner-execute) is 0. This means you cannot ./script.sh on a 644 file. I have seen many beginners confused about why their script returns Permission denied even though they own it. The answer is always bit 6. Add execute with chmod +x (which sets bit 6) or change the mode to 755.
The decimal value of 644 is 420 (256 + 128 + 0 + 32 + 0 + 0 + 4 + 0 + 0 = 420). I find it interesting that 420 is also a common default umask calculation, but let's stay focused on the binary analysis.
| Bit | Class | Permission | 644 Value | Meaning |
|---|---|---|---|---|
| 8 | Owner | Read | 1 | Owner can read |
| 7 | Owner | Write | 1 | Owner can write |
| 6 | Owner | Execute | 0 | Owner cannot execute |
| 5 | Group | Read | 1 | Group can read |
| 4 | Group | Write | 0 | Group cannot write |
| 3 | Group | Execute | 0 | Group cannot execute |
| 2 | Others | Read | 1 | Others can read |
| 1 | Others | Write | 0 | Others cannot write |
| 0 | Others | Execute | 0 | Others cannot execute |
One practical tip I have learned: if you are setting up a web server, ensure your static assets are 644 and your directories are 755. This is the minimum permission set that allows your web server (running as a specific user or group) to read and serve files while preventing unauthorized modifications.
chmod 777 has every single one of the 9 bits set to 1. The binary is 111111111 and the rwx notation is rwxrwxrwx. Every user class — owner, group, and others — has read, write, and execute access.
In my professional opinion, 777 is almost never the right answer. I have seen it used as a shortcut — "just chmod 777 it" — by developers who cannot figure out why their application cannot write to a directory. The binary analysis reveals why this is dangerous: bits 1, 0, and 4 are all 1, meaning anyone on the system can modify your files and traverse your directories.
If a PHP application needs write access to a cache directory, the correct approach is to set the directory owner to the web server user and use 755 or 775, not 777. The binary difference between 755 and 777 is just bits 4 and 1 (group-write and others-write). Those two bits are the difference between a secure server and a compromised one.
Beyond the big three (755, 644, 777), there are several other permission values I use regularly:
Binary 110000000. Only the owner can read and write. Group and others get nothing. This is what I use for SSH keys (~/.ssh/id_rsa), database credentials, and API tokens. If any bit in the group or others triple is 1, a private key file will be rejected by SSH with Permissions 0644 for 'id_rsa' are too open.
Binary 111000000. The owner has full control; everyone else has no access at all. I use this for personal scripts and directories containing sensitive operations. It is like 755 but with group and others locked out entirely.
Binary 100000000. Only bit 8 is set. The owner can only read — not write, not execute. I use this for certificate files (.pem, .crt) that need to be readable by services but should never be modified accidentally.
Binary 101101101. Everyone can read and execute, but nobody can write. This is useful for system binaries that should not be modified by any user, including root. It is essentially 755 with the write bits cleared from all triples.
| Octal | Binary | Symbolic | Common Use |
|---|---|---|---|
| 400 | 100000000 | -r-------- | Certificate files, read-only data |
| 600 | 110000000 | -rw------- | SSH keys, credentials, secrets |
| 644 | 110100100 | -rw-r--r-- | Regular files, web assets |
| 700 | 111000000 | -rwx------ | Private scripts, personal tools |
| 755 | 111101101 | -rwxr-xr-x | Directories, executables, scripts |
| 775 | 111111101 | -rwxrwxr-x | Shared project directories |
| 777 | 111111111 | -rwxrwxrwx | Should almost never be used |
Beyond the standard 9 permission bits, there are 3 special permission bits that precede the owner triple: setuid (bit 11, octal 4000), setgid (bit 10, octal 2000), and the sticky bit (bit 9, octal 1000). When you see a 4-digit octal like 4755, the first digit is one of these special bits.
The setuid bit (bit 11) makes an executable run with the owner's effective user ID rather than the user who launched it. When setuid is active, the owner-execute position shows s instead of x. The binary representation of 4755 is 12 bits long: 100111101101.
In my experience, setuid binaries like passwd and ping are the most common examples. They need elevated privileges to function but are carefully audited for security. I recommend never setting the setuid bit on your own scripts unless you fully understand the security implications.
Use the bitwise calculator to convert any chmod octal value to its binary representation. See the exact bit positions change as you adjust permissions.
chmod 755 in binary is 111101101. It breaks down as: 7 (owner) = 111 = rwx, 5 (group) = 101 = r-x, 5 (others) = 101 = r-x. The full 9-bit mask is 111101101, which gives the owner full read/write/execute permissions and everyone else read and execute only.
In a 9-bit chmod mask, bit 8 is owner-read, bit 7 is owner-write, bit 6 is owner-execute, bit 5 is group-read, bit 4 is group-write, bit 3 is group-execute, bit 2 is others-read, bit 1 is others-write, and bit 0 is others-execute. Each bit is either 1 (permission granted) or 0 (permission denied).
chmod 644 in binary is 110100100. The three triples are: owner = 110 (rw-), group = 100 (r--), others = 100 (r--). The decimal value of the full 9-bit binary number 110100100 is 420. Only the owner can write; everyone else reads only.
Read chmod binary output in three 3-bit groups from left to right. The first group is the owner permissions, the second is the group, and the third is others. Within each group, the high bit is read, middle is write, low is execute. For example, 111101101: 111=rwx (owner), 101=r-x (group), 101=r-x (others).
chmod uses octal because each octal digit (0-7) maps exactly to a 3-bit rwx permission triple. Decimal digits do not align with 3-bit boundaries. With octal, 755 clearly shows three independent permission values: 7 (owner), 5 (group), 5 (others). With decimal, the same permission would be 493, which hides the underlying triple structure.
To compute the binary from ls -l output like rwxr-xr-x, replace each r, w, x with 1 and each dash with 0. Then group by three. rwxr-xr-x becomes 111101101. Convert each 3-bit group to octal: 111=7, 101=5, 101=5, giving chmod 755.
chmod 4755 in 12-bit binary is 100111101101. The first three bits (100) represent the special permissions: the leading 4 means the setuid bit (bit 11) is set. The remaining 9 bits are the standard permission mask: 111 (owner=rwx), 101 (group=r-x), 101 (others=r-x).