Chmod Calculator
Linux file permissions, converted between checkboxes, the octal number and the rwx letters, special bits included, with the chmod commands that set them, warnings, symbolic changes and what a umask leaves.
Overview
Every file and directory on a Unix system carries nine permission bits: read, write and execute, once for
its owner, once for its group and once for everyone else. Three more, setuid, setgid and sticky, change how a
program runs or who may delete files in a directory. chmod sets all twelve, and they are written in
two ways. The number gives each kind of user one octal digit, the sum of read 4, write 2 and execute 1, so
755 is 7 for the owner and 5 for group and public; a fourth digit in front carries the special
bits. The letters spell the same bits out in a fixed order, rwxr-xr-x, with a dash where a
permission is missing. The calculator turns either into the other and into ticks you can change.
Web interface
Permissions for a File or Directory at the top chooses what the permissions
are for. Each box shows what it allows in brackets, such as Read (open) for a file and Read (list) for a
directory, and the sentences, the warnings and the ls -l line follow the same choice. Four boxes,
Owner, Group, Public and Special, hold the
twelve bits, with the digit they add up to beside each name; the (i) beside each special bit explains it on
hover or on a click. Under them are two fields, Numeric
and Symbolic. A tick, or typing into either field, rewrites the rest at once; a complaint about
the input appears under its field once you stop typing. The buttons under the fields fill in common
permissions; those with a sticky or setgid bit switch to Directory. Right under the buttons, warnings appear as
soon as the permissions call for one.
Linux Permissions takes a file name and an option for -R, and shows:
| Row | What it is |
|---|---|
| Command | chmod 755 file, the number |
| Symbolic command | chmod u=rwx,g=rx,o=rx file, the same in letters, with s and t for special bits |
| Check on Linux | stat -c '%a %A' file, which prints the number and the letters a file has now |
| Check on macOS | stat -f '%Lp %Sp' file, the same with BSD stat |
| Numeric | the number on its own |
| ls -l | the letters as ls -l prints them, with - or d in front |
| Owner, Group, Public, Special | what each may do, in words for a file or for a directory |
A file name with spaces or other characters the shell treats specially is put in single quotes, and one that
starts with a dash gets -- before it. A click on a value selects all of it, ready to copy.
URL parameters
| Pattern | Example |
|---|---|
| /calculate/chmod/{octal} | /calculate/chmod/755 |
| /calculate/chmod/{special}{octal} | /calculate/chmod/1777 |
| /calculate/chmod/{letters} | /calculate/chmod/rwsr-xr-x |
The address bar follows every change, always as the number. File or directory, the file name and the other panels are not part of the address.
Input rules
- The numeric field takes three digits from 0 to 7, owner first, or four with the special bits in front.
A leading zero before four digits,
01777, is passed over. - The symbolic field takes nine characters in the order r, w, x for owner, group and public, a dash for a
permission that is missing, and
s,S,torTin the execute places for the special bits. - The file type
ls -lputs in front,-rwxr-xr-xordrwxr-xr-x, is read as well, and-ordswitches between File and Directory.
| Message | When |
|---|---|
Use the digits 0 to 7. | an 8, a 9 or a letter in a numeric field |
At least three digits are needed, one each for owner, group and public. | fewer than three digits |
At most four digits: special bits, owner, group, public. | five or more |
Nine characters are needed, three each for owner, group and public, such as rwxr-xr-x. | letters of another length |
Position 2 must be w or -, the order is always r, w, x. | a letter in the wrong place |
Position 3 must be x, s, S or -. | another letter in an execute place |
Special bits
| Bit | Digit | On a file | On a directory |
|---|---|---|---|
| Setuid | 4 | the program runs with its owner's rights, as passwd does | ignored on Linux |
| Setgid | 2 | the program runs with its group's rights | new files get the directory's group instead of their creator's |
| Sticky | 1 | no effect on Linux | only a file's owner, the directory's owner or root may delete or rename it, as on /tmp |
In the letters a special bit takes the place of the execute bit it belongs to: s for owner and
group, t for public, lower case when execute is set as well and upper case when it is not, so
rwSr--r-- is setuid without execute. Linux ignores setuid and setgid on scripts. GNU chmod does not
clear setuid or setgid on a directory when given a number of four digits or fewer; chmod g-s dir
does.
Files and directories
| Permission | On a file | On a directory |
|---|---|---|
| Read | open it and read its content | list the names in it |
| Write | change its content | create, rename and delete files in it |
| Execute | run it as a program or script | enter it and reach what is inside |
Deleting a file needs write on its directory, not on the file, so a read-only file in a directory you may write to can still be removed. The root user is not held back by any of these bits.
Warnings
Under the fields, red notes mark permissions that let more people do more than intended, and grey ones explain a combination that does not do what it seems to.
| Shown when | Kind |
|---|---|
| public may write a file | warning |
| public may write a directory without the sticky bit | warning |
| the owner may do less than group or public; only the owner's bits apply to the owner | warning |
| a file with setuid or setgid that group or public may write | warning |
| setuid or setgid on a file without the matching execute bit | note |
| setuid or setgid on a file, which Linux ignores on scripts | note |
| sticky on a file, or setuid on a directory, neither of which does anything on Linux | note |
| a directory someone may list but not enter, or enter but not list | note |
| a file someone may execute but not read, which a script needs | note |
Change with chmod
This panel applies a change in chmod's symbolic syntax to the permissions above and shows the result before
you take it with Apply or Enter. A change is who, then +, - or
=, then the permissions; several are joined by commas and applied in order.
| Part | Meaning |
|---|---|
u g o a | owner, group, public, all three; nothing in front also means all three |
+ - = | add, remove, set exactly |
r w x | read, write, execute |
X | execute, but only for a directory or where someone may execute already |
s t | setuid or setgid for u or g, sticky for o |
u g o after the sign | copy that class's bits, as in g=u |
Examples: g+w,o-rwx, a+X, u=rwx,go=rx, +t. One difference
from chmod itself: chmod leaves the bits set in the umask alone when a change names no one, as in
+w; here it applies to everyone.
umask
The umask is the set of bits a new file or directory does not get. Programs ask for 666 for a
file and 777 for a directory, and the system takes away what the umask holds. With the usual
022, new files are 644 and new directories 755; with 077,
600 and 700. Use takes either result into the calculator.
umask on its own prints the current mask.
No API
There is no API for this tool. The conversion is a sum of three numbers per digit, done in the browser;
on the system itself stat -c %a file prints the number and ls -l the letters.
Privacy
Nothing leaves the browser. The permissions and the file name are worked out on the page and are not stored or sent. The address bar changes as you go and holds the number only, which puts it into the browser's history like any other page.