Skip to content

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 filename
chmod u=rwx,g=rx,o=rx filename

ls -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

Frequently Asked Questions

What does chmod 755 mean?
755 gives the owner read, write and execute (7 = 4 + 2 + 1), and gives the group and everyone else read and execute (5 = 4 + 1). It is the usual setting for directories, scripts and programs that others need to run but not change.
What is the difference between 644 and 755?
Both let everyone read the file and only the owner change it. 755 also adds the execute bit for everyone. Use 644 for ordinary files such as HTML, images and config, and 755 for directories and executable scripts.
Why should I avoid chmod 777?
777 lets every user on the system change or replace the file. On a web server that means any compromised process can modify your code. Fix ownership with chown, or use 775 with a shared group, instead of opening permissions to everyone.
What do setuid, setgid and the sticky bit do?
setuid (4000) runs an executable as its owner, which is how passwd can edit system files. setgid (2000) runs it as the file's group, and on a directory makes new files inherit the directory's group. The sticky bit (1000) on a directory, as on /tmp, lets only a file's owner delete or rename it.
What do the capital S and T mean in ls -l output?
A lowercase s or t means the special bit and the execute bit are both set. A capital S or T means the special bit is set but execute is not, which is usually a mistake because setuid and setgid have no effect on a file nobody can execute.
What permissions should SSH keys have?
Private keys should be 600 (owner read and write only) and the ~/.ssh directory 700. SSH refuses to use a private key that other users can read.