chmod Calculator

Unix file permissions in octal and rwx, both ways.

About this tool

Tick read, write and execute for owner, group and others to get the octal mode and the chmod command, or type a mode like 755 or rwxr-xr-x to see what it allows. Includes setuid, setgid and the sticky bit.

How to use it

  1. Type a mode like 755, 0644 or rwxr-xr-x, or paste the first column of ls -l.
  2. Or tick read, write and execute for the owner, the group and everyone else.
  3. Add setuid, setgid or the sticky bit if you need them.
  4. Enter the file name and copy the chmod command.

Questions

What does chmod 755 mean?
The owner can read, write and execute; the group and everyone else can read and execute. It is the usual mode for scripts, programs and folders.
What is the difference between 644 and 755?
644 (rw-r--r--) is for normal files: only the owner can change them and nobody can run them. 755 adds execute permission, which programs need to run and folders need so people can open them.
Why does my SSH key need 600?
SSH refuses private keys that other users can read. 600 means only you can read and write the file, which is exactly what it checks for.
Is chmod 777 ever a good idea?
Rarely. It lets every user on the machine change or replace the file. When something only works with 777, the real fix is usually the right owner (chown) or group, not wider permissions.
What do the s and t letters mean?
s in the owner or group position is setuid or setgid: the program runs with the file owner’s or group’s rights, or new files in a folder inherit its group. t is the sticky bit: in a shared folder like /tmp, people can only delete their own files.
Why does chmod say “Operation not permitted”?
Only the file’s owner or root can change its mode, so use sudo or fix the owner with chown first. On FAT, exFAT and many network shares, permissions aren’t stored at all and come from mount options instead. On Linux, a file marked immutable with chattr +i also refuses chmod until the flag is removed.
Does Git keep file permissions?
Only the execute bit. Git records a file as 100644 or 100755 and ignores everything else, including group and others. To mark a script executable from Windows, run git update-index --chmod=+x script.sh. If Git reports mode changes you didn’t make, for example on a shared drive, set core.fileMode to false for that repository.
What is the difference between chmod and chown?
chmod changes what the owner, the group and others may do with a file. chown changes who the owner and group are, as in sudo chown www-data:www-data uploads. When a service can’t write somewhere, giving the folder to the service’s user or group is safer than widening the mode for everyone.

How do chmod numbers work?

Each permission has a value: read is 4, write is 2 and execute is 1. Add them up to get one digit, so 7 means rwx, 6 means rw- and 5 means r-x. A mode has three digits, for the owner, the group and everyone else, in that order. That is why chmod 640 gives the owner read and write, the group read only, and others nothing. The Number Base Converter shows each digit as three binary bits.

A fourth digit in front sets the special bits: 4 for setuid, 2 for setgid and 1 for the sticky bit, so chmod 2775 is 775 plus setgid. In the first column of ls -l, the first character is the file type (d for a folder, l for a symlink, - for a regular file), followed by nine permission letters. A capital S or T means the special bit is set but execute is not, which is usually a mistake.

chmod numbers vs letters (symbolic mode)

Numbers always set all nine bits at once: chmod 644 file replaces whatever was there. Letters can change one thing and keep the rest. chmod u+x deploy.sh adds execute for the owner, chmod go-w file removes write for group and others, and = sets an exact list, as in chmod o= secret.txt. Every result here is shown both ways, for example chmod 755 file and chmod u=rwx,g=rx,o=rx file.

When you leave out u, g, o or a, chmod applies the change to everyone but skips bits blocked by your umask. The umask also decides the mode of new files: with the common umask 022, new files get 644 and new folders get 755. Run umask to see yours. If teammates keep creating files the group can’t edit, a umask of 002 is usually the fix, not a later chmod -R.

How to chmod folders and files differently

chmod -R 755 dir makes every file executable, which is rarely what you want. Use a capital X instead: chmod -R u=rwX,go=rX dir gives execute only to folders and to files that were already executable. For strict 755 folders and 644 files, run two passes: find dir -type d -print0 | xargs -0 chmod 755, then the same with -type f and 644.

“Permission denied” on a file that looks readable usually comes from a folder above it. To open a path you need execute permission on every folder along the way, and read permission to list a folder’s contents. A 644 file inside a 700 folder stays private to the owner. On Linux, namei -l /path/to/file prints the mode of each part of the path, so you can spot the folder that blocks access.

Common chmod permissions

The modes you will meet most often, what each one allows and where it is used.

ModerwxWho can do whatTypical use
chmod 755rwxr-xr-xOwner can read, write and execute. Group can read and execute. Others can read and execute.Scripts, programs and folders that others may open
chmod 644rw-r--r--Owner can read and write. Group can read. Others can read.Regular files: everyone can read them, only you can edit
chmod 600rw-------Owner can read and write. Group can do nothing. Others can do nothing.Private files such as SSH keys and .env files
chmod 700rwx------Owner can read, write and execute. Group can do nothing. Others can do nothing.Private folders and scripts that only you may run
chmod 775rwxrwxr-xOwner can read, write and execute. Group can read, write and execute. Others can read and execute.Folders a group works in together
chmod 664rw-rw-r--Owner can read and write. Group can read and write. Others can read.Files a group edits together
chmod 750rwxr-x---Owner can read, write and execute. Group can read and execute. Others can do nothing.Programs and folders for you and your group only
chmod 640rw-r-----Owner can read and write. Group can read. Others can do nothing.Config files a service’s group may read
chmod 444r--r--r--Owner can read. Group can read. Others can read.Read-only files nobody should change
chmod 777rwxrwxrwxOwner can read, write and execute. Group can read, write and execute. Others can read, write and execute.Everyone can do everything: avoid it outside throwaway tests

Something not working, or a result looks wrong? Report a problem with this tool