| Entity | Read (r) +4 |
Write (w) +2 |
Execute (x) +1 |
Octal |
|---|---|---|---|---|
| Owneruser (u) | 7 | |||
| Groupgroup (g) | 5 | |||
| Othersother (o) | 5 | |||
| Specialsetuid/setgid/sticky | 0 |
| Octal | Symbolic | Description |
|---|
chmod octal โ symbolic โ human-readable. Includes umask calculator.
| Entity | Read (r) +4 |
Write (w) +2 |
Execute (x) +1 |
Octal |
|---|---|---|---|---|
| Owneruser (u) | 7 | |||
| Groupgroup (g) | 5 | |||
| Othersother (o) | 5 | |||
| Specialsetuid/setgid/sticky | 0 |
| Octal | Symbolic | Description |
|---|
Linux File Permissions Calculator converts between symbolic (rwxr-xr--) and octal (755, 644) permission notation for Unix/Linux file permissions. Select permission bits visually (read/write/execute for owner, group, and others) and see the numeric and symbolic representations, or enter an octal code to see what it means. Also explains special bits: setuid, setgid, and sticky bit.
Linux file permissions use a 9-bit system (3 bits each for owner, group, and others) with read (r=4), write (w=2), and execute (x=1). The three permission sets are: owner (u โ user), group (g), and others (o). Symbolic notation: rwxrwxrwx (full access) or rw-r--r-- (owner read-write, group/others read-only). Octal notation: each set is the sum of its bits โ rwx=7, rw-=6, r-x=5, r--=4, -wx=3, -w-=2, --x=1, ---=0. So 755 means rwxr-xr-x, and 644 means rw-r--r--.
Special permission bits (the 4th octal digit): setuid (4xxx): when set on an executable, the program runs with the file owner's privileges (used by /usr/bin/passwd to allow regular users to change their own password). setgid (2xxx): on executables, runs with group privileges; on directories, new files inherit the group. Sticky bit (1xxx): on directories, only the file owner (or root) can delete files โ used on /tmp to prevent users from deleting each other's temp files.
Web server file permissions
Result: 644 โ rw-r--r-- โ owner can read+write, group/others can only read
Executable script
Result: 755 โ rwxr-xr-x โ owner can read/write/execute, group/others can read+execute
Private SSH key
Result: 600 โ rw------- โ only owner can read+write (SSH requires this for private keys)
What do the numbers in chmod 755 mean?
Each digit in octal notation is the sum of permission bits: read=4, write=2, execute=1. First digit: owner. Second: group. Third: others. 7 = 4+2+1 = rwx (read+write+execute). 5 = 4+0+1 = r-x (read+execute, no write). 5 = 4+0+1 = r-x. So 755 = rwxr-xr-x: owner can do everything, group and others can read and execute but not write. Common values: 644 (files), 755 (directories, executables), 600 (private files), 700 (private directories), 777 (all access โ avoid on servers).
What is the difference between chmod and chown?
chmod (change mode) changes the permission bits โ who can read, write, execute. chown (change owner) changes the owner and/or group of a file. Example: chmod 755 script.sh changes permissions. chown alice:developers script.sh changes owner to 'alice' and group to 'developers'. chown -R (recursive) applies to all files in a directory. On Linux: chgrp is a separate command to change only the group. To change a file's owner, you typically need root (sudo) or to be the current owner.
What permissions should I use for web server files?
Standard web server permissions: Files: 644 (rw-r--r--) โ web server (www-data/nginx/apache) needs read access; only owner writes. Directories: 755 (rwxr-xr-x) โ web server needs execute (traverse) on directories. PHP/writeable directories (uploads, cache): 775 or 755 with www-data as group. Never use 777 on production servers โ it allows any user on the system to write files. SSH private keys must be 600 (too-open private keys cause SSH to refuse the key). .env files: 600 or 640.
What is the sticky bit and where is it used?
The sticky bit (chmod +t or 1xxx) on a directory means: only the file's owner, the directory's owner, or root can delete or rename files in that directory โ even if other users have write permission to the directory. Primary use: /tmp directory (mode 1777, drwxrwxrwt) allows all users to create files in /tmp, but only delete their own files. Set sticky bit: chmod +t /directory or chmod 1755 /directory. The 't' in the symbolic output (rwxrwxrwt) indicates the sticky bit is set.
How do I recursively change permissions on a directory?
chmod -R mode directory recursively changes permissions. Be careful: using one mode for both files and directories is usually wrong. Directories need execute bit (to traverse), files usually don't. Better approach: chmod -R 644 /var/www && find /var/www -type d -exec chmod 755 {} +. The find approach applies 644 to files and 755 to directories separately. For web roots: find /var/www -type f -exec chmod 644 {} + && find /var/www -type d -exec chmod 755 {} +. Or use ACLs (setfacl) for fine-grained control.