BrowserTools
Home / Calculators / Chmod Calculator

Chmod Calculator

Work out Unix file permissions as numbers like 755 or letters like rwxr-xr-x, and see what they allow.

Loading Chmod Calculator… If nothing happens, please enable JavaScript.

Every file and directory on Linux, macOS and other Unix-like systems carries three sets of permissions: one for its owner, one for its group and one for everyone else. Each set can allow reading, writing and executing, and chmod is the command that changes them. This calculator shows the same permissions in all the forms you meet in practice. Tick the boxes in the grid, type a number such as 644 or 2775, or paste the letters from ls -l such as drwxr-sr-x, and the other two forms update instantly. Below them you get ready-to-copy chmod commands in both numeric and symbolic form (chmod 755 file and chmod u=rwx,g=rx,o=rx file), with an optional file name and a recursive -R switch.

Frequently asked questions

What does chmod 755 mean?
Each digit is one class: owner, group, others. 7 is read (4) plus write (2) plus execute (1), and 5 is read plus execute. So 755 lets the owner do everything, while the group and everyone else can read and run the file, or list and enter the directory, but not change it. In letters it is rwxr-xr-x. It is the usual mode for programs, scripts and web directories.
What is the difference between 644 and 755?
Both let only the owner write. 644 (rw-r--r--) gives no execute permission to anyone, which suits documents, images, configuration and web pages. 755 adds execute for all three classes, which programs need to run and directories need so people can enter them. Directories set to 644 cannot be entered at all, which is a common cause of "Permission denied" errors.
What do s, S, t and T mean in the permission string?
A lowercase s in the owner's execute slot means setuid plus execute, and in the group's slot it means setgid plus execute. A lowercase t in the others' slot means the sticky bit plus execute. The capital letters S and T mean the special bit is set but the execute permission is not, which usually makes the bit useless on a file. For example 4755 is rwsr-xr-x and 1777 is rwxrwxrwt.
What do setuid, setgid and the sticky bit do?
Setuid makes a program run with the permissions of the file's owner rather than the user who starts it, which is how passwd can update the password database. Setgid does the same for the group, and on a directory it makes new files inherit the directory's group. The sticky bit on a directory means only a file's owner, the directory's owner or root can delete or rename it, which is why /tmp is 1777.
Why should I avoid chmod 777?
777 lets every account on the machine, including the web server and any compromised service, change or replace the file. On a directory it also lets anyone delete other people's files. It often hides the real problem, which is usually the wrong owner or group. Fix ownership with chown and use 755 or 775 for directories and 644 or 664 for files instead.
How do I set different permissions for files and directories recursively?
chmod -R applies one mode to everything, so files would get execute permission along with the directories. Use find instead: find path -type d -exec chmod 755 {} + for directories and find path -type f -exec chmod 644 {} + for files. Symbolic mode offers a shortcut too: chmod -R u=rwX,go=rX path, where the capital X adds execute only to directories and to files that are already executable.
What is a umask?
The umask is a set of bits removed from the default permissions when a program creates something new. Files start from 666 and directories from 777, and each bit in the umask is taken away. With the common umask 022, new files are 644 and new directories 755. With 077 they are 600 and 700, so only you can access them. Run umask in a terminal to see your current value.
Does chmod 755 on a directory clear its setgid bit?
Not with GNU chmod on Linux. For directories it keeps existing setuid and setgid bits when you give a numeric mode, so shared folders do not lose their group inheritance by accident. To clear them, use symbolic mode such as chmod g-s dir, or a numeric mode with an extra leading zero, such as chmod 00755 dir. Other systems may behave differently, so check with ls -l afterwards.

About Chmod Calculator

The numbers are octal: each digit is the sum of read (4), write (2) and execute (1) for one class, so 7 means all three, 6 means read and write, 5 means read and execute and 4 means read only. A fourth digit in front holds the special bits: 4 for setuid, 2 for setgid and 1 for the sticky bit. In the letter form these appear in the execute slots as s or t, and as a capital S or T when the special bit is set without the execute permission underneath it. The calculator understands all of these, and the explanation panel spells out in plain English what the owner, the group and everyone else can actually do. Switch between File and Directory, because the same bits mean different things: on a directory, read lets you list names, write lets you create and delete files, and execute lets you enter it and reach the files inside.

The common presets cover everyday cases: 644 for ordinary files, 755 for scripts and directories, 600 and 700 for private keys and folders, 664 and 775 for group collaboration, 400 for read-only secrets and 1777 for shared temporary directories. The tool warns when a mode is risky, for example 777, world-writable directories without the sticky bit or a writable setuid program. There is also a umask calculator: enter a umask such as 022 or 077 and see the permissions new files (starting from 666) and new directories (starting from 777) will get. Everything is calculated in your browser.

The sticky bit once kept programs in memory

The sticky bit got its name in early Unix, long before it had anything to do with shared directories. On a program file, it told the system to keep the program's text in swap space after it finished running, so frequently used commands such as the editor or the shell would start faster next time. The program was said to stick around.

As virtual memory and page caches improved, that trick stopped being useful and most systems began ignoring the bit on files. In the 1980s it was given a new job on directories: only the owner of a file may delete or rename it, even when the directory is writable by everyone. That is the meaning it has today, and the reason every Linux and macOS system shows a t at the end of drwxrwxrwt for /tmp.

Support