Skip to content
Jellykit

Chmod Calculator

Convert Unix file permissions between checkboxes, octal such as 755 and symbolic rwxr-xr-x, including setuid, setgid, sticky and umask.

  • Runs on your device
Loading tool

About Chmod Calculator

Tick read, write and execute for the owner, the group and everyone else, and see the mode as octal, as ls -l prints it, and as ready-to-run chmod commands. The special bits (setuid, setgid and sticky) are included, with the capital S and T that ls shows when they are set without execute.

Already have a mode? Type 644, -rwxr-x---, or an expression such as go-w into the box under the form and the checkboxes follow. Set a umask to see what new files and directories will get.

How it works

  1. Each of the three groups (owner, group, others) has three bits: read is 4, write is 2 and execute is 1. Their sum is one octal digit, so rwxr-xr-x is 7, 5, 5.
  2. The special bits form a fourth digit in front: setuid is 4, setgid is 2 and sticky is 1. 4755 is a setuid program anyone can run.
  3. A chmod expression such as u+x or go-w is applied to the mode currently ticked, the way chmod applies it to a file. Without u, g or o it applies to everyone, as if your umask were 000.
  4. New files start from 666 and new directories from 777; the umask removes the bits it names, so a umask of 022 gives 644 and 755.

Questions

What is the difference between s and S in ls -l?

A lowercase s means setuid or setgid is set and so is the execute bit underneath it. A capital S means the special bit is set but execute is not, which on most systems makes it do nothing. The same goes for t and T with the sticky bit.

Which mode should a web server file have?

Commonly 644 for files and 755 for directories: the owner can change them, everyone else can only read them. Private keys and configuration with secrets are usually 600. Avoid 777, which lets any user on the machine change the file.

Why does a capital X in an expression not always add execute?

X adds execute only if some execute bit is already set, which on a real system also covers directories. Here it follows the ticked mode, so it adds execute when at least one execute box is ticked.

Everything you enter here is processed in this browser tab. Nothing is uploaded, logged or shared. How privacy works here.