Dev tools

Chmod calculator

Convert Unix permissions between octal (755) and symbolic (rwxr-xr-x) form, including setuid/setgid/sticky bits. Runs on your device.

Runs on your device. The file is never uploaded.

Chmod calculator turns a Unix mode written as 755 into rwxr-xr-x, or the reverse, deciding the direction from the shape of what you type. A fourth octal digit carries setuid, setgid and sticky, appearing as s, S, t or T in the execute slots. Relative chmod syntax such as u+x is refused; only a complete mode converts.

Options

Questions

Which direction does it convert?

Both, and it works out which from what you type. Three or four octal digits convert to symbolic, so 755 gives rwxr-xr-x. A nine-character symbolic string converts to octal, so rwxr-xr-x gives 755. A leading file-type character is allowed and ignored, which means you can paste -rwxr-xr-x or drwxr-xr-x straight out of ls -l.

Does it handle setuid, setgid and the sticky bit?

Yes, in both directions. A fourth leading octal digit carries them: 4 for setuid, 2 for setgid, 1 for sticky. In symbolic form they appear in the execute position as s or t when execute is also set, and as capital S or T when it is not, which is the convention ls uses. Reading the other way, an s, S, t or T is decoded back into that leading digit.

Can I type chmod syntax like u+x?

No. This converts between the two notations for a complete mode, not the relative form chmod accepts on the command line. u+x, go-w and a=r are all rejected with a message saying the input is neither a valid octal mode (e.g. 755) nor a symbolic mode (e.g. rwxr-xr-x). Write out the full mode you want instead.

Why was my symbolic string rejected?

Usually length or a stray character. After any leading d, l or dash, the body must be exactly nine characters, three each for user, group and other. Each triple is r or dash, then w or dash, then one of x, s, t, S, T or dash. A short string gives "expected a 9-character permission string (e.g. rwxr-xr-x)" with your input quoted back at you.

Does it accept a four-digit mode like 0755?

Yes. Three and four digits are both accepted, and a leading zero simply means no special bits are set. Each digit must be 0 to 7, so 855 and 79 do not parse, and five digits are not accepted either. When converting the other way, a mode with no special bits is printed without its leading zero.

Related Dev tools