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:

RowWhat it is
Commandchmod 755 file, the number
Symbolic commandchmod u=rwx,g=rx,o=rx file, the same in letters, with s and t for special bits
Check on Linuxstat -c '%a %A' file, which prints the number and the letters a file has now
Check on macOSstat -f '%Lp %Sp' file, the same with BSD stat
Numericthe number on its own
ls -lthe letters as ls -l prints them, with - or d in front
Owner, Group, Public, Specialwhat 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.

PatternExample
/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, t or T in the execute places for the special bits.
  • The file type ls -l puts in front, -rwxr-xr-x or drwxr-xr-x, is read as well, and - or d switches between File and Directory.
MessageWhen
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

BitDigitOn a fileOn a directory
Setuid4the program runs with its owner's rights, as passwd doesignored on Linux
Setgid2the program runs with its group's rightsnew files get the directory's group instead of their creator's
Sticky1no effect on Linuxonly 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

PermissionOn a fileOn a directory
Readopen it and read its contentlist the names in it
Writechange its contentcreate, rename and delete files in it
Executerun it as a program or scriptenter 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 whenKind
public may write a filewarning
public may write a directory without the sticky bitwarning
the owner may do less than group or public; only the owner's bits apply to the ownerwarning
a file with setuid or setgid that group or public may writewarning
setuid or setgid on a file without the matching execute bitnote
setuid or setgid on a file, which Linux ignores on scriptsnote
sticky on a file, or setuid on a directory, neither of which does anything on Linuxnote
a directory someone may list but not enter, or enter but not listnote
a file someone may execute but not read, which a script needsnote

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.

PartMeaning
u g o aowner, group, public, all three; nothing in front also means all three
+ - =add, remove, set exactly
r w xread, write, execute
Xexecute, but only for a directory or where someone may execute already
s tsetuid or setgid for u or g, sticky for o
u g o after the signcopy 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.