Chmod Calculator - Linux File Permissions (755, 644)
| Read (4) | Write (2) | Execute (1) | Digit | |
|---|---|---|---|---|
| Owner (u) | 7 | |||
| Group (g) | 5 | |||
| Others (o) | 5 |
chmod 755 filenamechmod u=rwx,g=rx,o=rx filenamels -l shows: -rwxr-xr-x
Common presets
How Linux file permissions work
Every file and directory on Linux and macOS has three sets of permissions: owner, group and everyone else. Each set has
read (r), write (w) and execute (x). Tick the boxes, type an octal mode like 755, or paste a symbolic string
like rwxr-xr-x (the 10-character ls -l form with a leading - or d
works too). All three stay in sync, and the matching chmod commands are ready to copy.
Octal notation
Read is 4, write is 2 and execute is 1. Add them up for each class of user to get one digit, written in the order owner, group, others. Each value is a separate bit, so every digit from 0 to 7 maps to exactly one combination.
7= 4 + 2 + 1 = read, write and execute (rwx)6= 4 + 2 = read and write (rw-)5= 4 + 1 = read and execute (r-x)4= read only (r--)3,2,1= write and execute, write only, execute only. Rare in practice.0= no access (---)
Example
You want a deploy script that you can edit and run, your team can run, and nobody else can touch. Tick read, write and execute for the owner, read and execute for the group, and nothing for others. The calculator shows:
Octal: 750
Symbolic: rwxr-x---
ls -l: -rwxr-x---
Commands: chmod 750 deploy.sh
chmod u=rwx,g=rx,o= deploy.sh Special bits
A fourth, leading digit holds the special bits: setuid (4), setgid (2) and sticky (1). For example 2775 is a shared
team directory where new files keep the directory's group, and 1777 is the classic /tmp setting where
anyone can create files but only the owner can delete them. In symbolic form these show up as s or
t in the execute position.
One GNU quirk: on Linux, chmod 755 on a directory leaves an existing setgid bit in place. To clear it, use
chmod g-s dir or the five-digit form chmod 00755 dir.
Directories are different
On a directory, read lets you list its contents, write lets you create and delete files in it, and execute lets you enter it and
reach the files inside. A directory without execute is effectively closed even if it is readable, which is why directories are
normally 755 or 750 rather than 644.
Applying permissions recursively
chmod -R 755 makes every file executable, which is rarely what you want. Either set directories and files
separately, with find . -type d -exec chmod 755 {} + and find . -type f -exec chmod 644 {} +,
or use a capital X: chmod -R u=rwX,go=rX . adds execute only to directories and to files that already had it.
Why new files are 644
New files start from 666 and new directories from 777, then the umask removes bits. The common umask 022 takes
write away from group and others, giving 644 and 755. A umask of 002, used on many shared servers, gives 664
and 775. Run umask to see yours.
Related Tools
Epoch / Unix Timestamp Converter
Convert between Unix epoch timestamps and human-readable dates.
Regex Tester
Test regular expressions against text with match highlighting.
UUID Generator
Generate random v4 UUIDs for use in databases and APIs.
Colour Converter
Convert colours between HEX, RGB, and HSL formats.