Skip to content
DeviceCheckHub

Chmod Calculator

Tick the boxes, or type a number such as 755 or the letters ls -l shows such as rwxr-xr-x, to see what a Linux file permission allows and get the chmod command for it. Try a change such as u+x or go-w to see what chmod will really do, and work out the umask for new files. It is a Linux file permissions calculator that follows GNU chmod exactly, and it runs in your browser.

Permission bits
Who421Digit
Owner (u)7
Group (g)5
Others (o)5
Special0
755 is -rwxr-xr-x.
Owner
read, change and run it
Group
read and run it
Others
read and run it
  • No special bits, and others can’t write.

Commands

Set it
chmod 755 script.sh
With letters
chmod u=rwx,g=rx,o=rx script.sh
A whole folder
chmod -R u=rwX,g=rX,o=rX script.sh
Check it
stat -c '%a %A %n' script.sh

Try a chmod change

chmod u+x,go-w turns 755 (-rwxr-xr-x) into 755 (-rwxr-xr-x).
StepOctalLetters
start755-rwxr-xr-x
u+x755-rwxr-xr-x
go-w755-rwxr-xr-x

umask

With umask 022, new files get 644 (-rw-r--r--) and new folders 755 (drwxr-xr-x).

New files start from 666, so no umask gives them execute; chmod +x is needed for 755.

How to use the chmod calculator

  1. Tick read, write and execute for the owner, the group and everyone else, or type the number (755) or the letters from ls -l (rwxr-xr-x or -rwxr-xr-x). The other two follow at once.
  2. Choose file or folder: the same bits mean different things on a folder, and the letters start with d.
  3. Read what each class may do in plain words, with a warning for anything risky such as write for everyone.
  4. Type the file or folder name and copy the command: the number, the same thing in letters, a safe version for a whole folder tree, and a stat command to check it.
  5. Type a change such as u+x, go-w or a=r to see what chmod will do to the mode above, step by step, including the bits your umask protects.

How the numbers work

Read is worth 4, write 2 and execute 1, and each digit is the sum for one class: the owner first, then the group, then everyone else. So 6 is read and write (4 + 2), 5 is read and execute (4 + 1) and 7 is all three. A fourth digit in front holds the special bits: 4 for set user ID, 2 for set group ID and 1 for the sticky bit, so 2775 is 775 with set group ID.

DigitLettersOn a file, may
0---no access
1--xrun it
2-w-change
3-wxchange and run it
4r--read
5r-xread and run it
6rw-read and change
7rwxread, change and run it

The letters ls -l shows

ls -l prints ten characters such as -rwxr-xr-x. The first is the type: - for a file, d for a directory, l for a symbolic link. Then come three groups of rwx for the owner, the group and others, with - where a permission is off. The special bits take the execute place: s for set user ID or set group ID, t for the sticky bit, in capitals (S or T) when execute underneath is off. A + or . at the end means extra access lists or an SELinux label; the calculator accepts and ignores it.

chmod changes: u+x, go-w, a=r

Besides a number, chmod takes changes made of who, an operator and permissions. Who is u (owner), g (group), o (others) or a (all). The operator + adds, - removes and = sets exactly. Permissions are r, w and x, s and t for the special bits, X for execute on folders and on files someone can already run, or one of u, g or o to copy that class, for example g=u. Separate several changes with commas: u=rwx,g=rx,o= gives 750.

Leave out who and chmod works on everyone, but keeps every bit your umask blocks. With umask 022, chmod +x adds execute for all three, while chmod +w adds write for the owner only and chmod -w on a 666 file takes it from the owner only, leaving 466. For a mode that starts with a minus, such as chmod -w file, GNU chmod then warns “new permissions are r--rw-rw-, not r--r--r--”. The change box shows the bits the umask held back. On a folder, GNU chmod with a number of four or fewer digits keeps set user ID and set group ID unless the number sets them; write 00755 or g-s to clear them.

Set user ID, set group ID and the sticky bit

Set user ID (4000) makes a program run with its owner’s rights instead of the user’s, which is how passwd (4755, owned by root) can update the password file. Linux ignores it on scripts and on folders. Set group ID (2000) on a program runs it with the file’s group; on a folder it makes new files inside take the folder’s group, which keeps shared project folders tidy. The sticky bit (1000) on a folder lets only each file’s owner delete or rename it, so /tmp is 1777: anyone can write there, but nobody can remove someone else’s files.

Folders are different

On a folder, read lets you list the names, write lets you create, delete and rename entries, and execute lets you enter it and reach the files inside. Write does nothing without execute, and you can delete a file you cannot read if you can write to its folder. To set a whole tree at once without making every file executable, use capital X (chmod -R u=rwX,g=rX,o=rX folder) or two find commands: find folder -type d -exec chmod 755 {} + and find folder -type f -exec chmod 644 {} +.

umask: permissions for new files

Programs create files asking for 666 and folders asking for 777, and the umask takes bits away. The usual 022 removes write for group and others, giving 644 and 755; 002 suits shared group work (664 and 775); 077 keeps new files private (600 and 700). A umask never adds execute to a file, so new scripts always need chmod +x.

Common permissions

NumberLettersUsed for
644-rw-r--r--Ordinary files: web pages, images, config
755drwxr-xr-xFolders, programs and scripts
600-rw-------Private files: SSH keys, .env, passwords
700drwx------Private folders such as ~/.ssh
664-rw-rw-r--Files a group edits together
775drwxrwxr-xFolders a group shares
640-rw-r-----Config the group may read, others not
750drwxr-x---Folders for owner and group only
400-r--------Read-only for the owner (AWS .pem keys)
444-r--r--r--Read-only for everyone
2775drwxrwsr-xShared folder, new files keep its group
1777drwxrwxrwtShared drop folder like /tmp
4755-rwsr-xr-xProgram that runs with its owner’s rights (passwd)
777drwxrwxrwxAnyone may do anything: avoid

Privacy

The calculator works entirely in your browser and never touches your files. Your last settings are saved in your browser’s local storage so they are there next time, and Copy a link puts the permission after a # in the link, a part that browsers never send to a server.

Frequently asked questions

What does chmod 755 mean?

Each digit is one class: the owner, the group, then everyone else. 7 is read (4) + write (2) + execute (1), and 5 is read + execute. So 755, or rwxr-xr-x, lets the owner read, change and run the file, and everyone else read and run it but not change it. It is the usual mode for programs, scripts and folders.

What is the difference between 644 and 755?

Only execute. 644 (rw-r--r--) is for ordinary files that are read but never run, such as web pages, images and settings. 755 (rwxr-xr-x) adds execute for everyone, which a script or program needs to run and a folder needs to be opened. Web servers usually want folders at 755 and files at 644.

Why is chmod 777 a bad idea?

It lets every account on the machine change or replace the file, or on a folder delete and replace anything inside it. On a web server that can turn a small bug into a hacked site. When something says permission denied, the fix is nearly always the right owner (chown) with 755 for folders and 644 for files, not 777.

What does chmod +x do?

It adds execute permission so the file can be run like a program: chmod +x script.sh, then ./script.sh. With no u, g, o or a in front, chmod keeps the bits your umask blocks, so with the usual umask 022 it adds execute for everyone. chmod u+x adds it for the owner only.

What permissions should SSH keys have?

The private key must be readable by you alone: chmod 600 ~/.ssh/id_ed25519 (400 works too). If it is more open, ssh refuses it with “Permissions 0644 for … are too open”. The ~/.ssh folder should be 700, authorized_keys 600, and public keys (.pub) can be 644.

What is the difference between x and X in chmod?

x always adds execute. Capital X adds execute only to folders and to files that already have execute for someone. That makes chmod -R u=rwX,g=rX,o=rX folder safe for a whole tree: folders become 755, plain files 644, and scripts that were executable stay executable.

How do I see the permission number of a file?

On Linux, stat -c %a file prints the number, such as 644, and stat -c %A prints the letters. ls -l shows the letters at the start of each line. On macOS the command is stat -f %Lp file.

What is umask?

The bits taken away from every new file and folder. New files start from 666 and new folders from 777, so the common umask 022 gives files 644 and folders 755, and 077 keeps everything private (600 and 700). Type umask in a terminal to see yours; set it in ~/.profile to keep it.

Last updated · About DeviceCheckHub