# Chmod calculator

Type a file mode as octal (755) or paste it from ls -l (-rw-r--r--) to see who can read, change and run the file, set it by owner, group and others, and copy the chmod command.

Page: https://toolkitnow.org/tools/chmod-calculator/

Type a mode such as 755, or paste one from ls -l such as -rw-r--r--, or set it below. The gray values are an example.

## Good to know

### The digits

One digit each for the owner, the group and everyone else, adding read 4, write 2 and run (execute) 1: 7 is all three, 5 is read and run, 4 is read only. A fourth digit in front holds the special bits.

### Common modes

`755` programs and folders; `644` ordinary files; `600` private files such as SSH keys; `700` private folders; `1777` shared folders like `/tmp`.

### Folders

On a folder, read lists its files, write adds and removes files, and run (x) lets you open it and reach the files inside. A folder without x cannot be entered, even with r.

### Special bits

Setuid (4) runs a program as its owner (as `passwd` does); setgid (2) runs it as its group (on Linux, only if the group can run it), and on a folder makes new files take the folder's group; sticky (1) on a shared folder lets only a file's owner (or the folder's owner) delete or rename it. A capital `S` or `T` in `ls -l` means the bit is set without run permission. GNU chmod (most Linux systems) leaves a folder's setuid and setgid bits as they are on `chmod 755`; `chmod 00755` clears them.

### From ls -l

The first letter is the type (`-` file, `d` folder, `l` link, whose own mode Linux ignores), and a `.` or `+` at the end marks an SELinux context or ACL. Both are read and set aside, as is the rest of a pasted line. Changes such as `u+x` depend on the current mode, so type the whole mode.

### Open from a link

`?mode=644` or `?mode=-rw-r--r--` opens the page with that mode.

Runs in the browser; nothing is uploaded. Part of toolkitnow.org.
