755 · rwxr-xr-x · setuid

chmod calculator

Read a permission mode in either notation, with the special bits shown as the different permissions they are.

Tick the permissions each class should have
WhoReadWriteExecute
Owner
Group
Other

Nothing leaves the tab; this is table lookup and arithmetic on nine bits.

Short answer: type either form and both appear, with a row per class and a plain-language summary. The special bits are called out separately because they change what a file can do, not just who can run it.

The digits, decoded

chmod 640 notes.txt gives the owner read and write (4 + 2), the group read (4), and everyone else nothing (0). In symbolic form that is rw-r-----. Six of the eight possible digits appear in the wild; if you ever see a 7 in the group slot of a secret file, it is worth asking why.

What the special bits actually do

Checking a mode a Dockerfile or deploy script set? Paste both versions into thetext diff rather than reading octal digits side by side, and use thebase converter if you need to see the same number in binary.

chmod questions

What do the three digits mean?

Owner, group, everyone else — in that order. Each digit is a sum of read (4), write (2) and execute (1), so 7 is rwx, 6 is rw- and 5 is r-x. That is why 755 means "the owner can do everything, everyone else can read and run".

What is the fourth digit?

The special bits: 4 setuid, 2 setgid, 1 sticky. They are not a "level" above 7 — they are a separate digit with one bit per class. 4755 is setuid on an otherwise 755 file, which is why the symbolic form is rwsr-xr-x and not rwsrwsrwt.

Why does <code>s</code> sometimes appear as <code>S</code>?

Lower-case s or t means the special bit is set AND the execute bit is set. Upper-case S or T means the special bit is set but execute is not — a state that is almost always a mistake, because setuid without execute does nothing useful.

Is setuid on a shell script dangerous?

It is worse than dangerous: most Linux kernels ignore setuid on interpreted scripts entirely, so the bit does nothing while the file looks privileged. Real setuid programs are compiled binaries that drop privileges as soon as they can.

What does x mean on a directory?

Permission to enter it — to traverse the path and reach the names inside. Read on a directory lists the names; execute lets you use them. A directory with r but not x is a list you cannot walk into.

Related tools