chmod and umask calculator
Type a mode as a number such as 755 or 2775, as letters such as rwxr-xr-x, or paste a line of ls -l, or tick the boxes. The page gives the mode in each form, the chmod command, and what owner, group and others may do with a file or a folder. Below it, see what a umask such as 022 leaves on new files and folders.
| Who | Read | Write | Execute |
|---|---|---|---|
| Owner | |||
| Group | |||
| Others |
Command
umask
The umask lists the permissions that new files and folders do not get. Programs usually create files with 666 and folders with 777, and the bits set in the umask are taken away: with the umask 022, files come out 644 and folders 755.
What each bit allows
A mode is four octal digits, read from the right: others, group, owner, and the special bits. A digit adds up 4 for read, 2 for write and 1 for execute, so 7 is all three and 5 is read and execute. A leading 0 changes nothing: 0755 is 755.
| Value | Bit | On a file | On a folder |
|---|---|---|---|
4000 | Set user ID (setuid) | The program runs with the file owner's rights. | On a few systems, new files get the folder's owner. |
2000 | Set group ID (setgid) | The program runs with the file group's rights. | New files and folders inside get the folder's group, and new folders get the setgid bit too. |
1000 | Sticky bit (restricted deletion) | Only some older systems use it on files. | Only a file's owner, the folder's owner or root may delete or rename files inside, as on /tmp. |
400 | Owner: read | Read the file. | List the folder. |
200 | Owner: write | Change the file. | Create, delete and rename files inside. |
100 | Owner: execute | Run the file as a program. | Enter the folder and open what is inside. |
40 | Group: read | As for the owner. | As for the owner. |
20 | Group: write | As for the owner. | As for the owner. |
10 | Group: execute | As for the owner. | As for the owner. |
4 | Others: read | As for the owner. | As for the owner. |
2 | Others: write | As for the owner. | As for the owner. |
1 | Others: execute | As for the owner. | As for the owner. |
The letters of ls -l
ls -l starts a line with the type (- a file, d a folder, l a link) and three letters each for owner, group and others. The special bits take the place of the execute letter:
| Letter | What it means |
|---|---|
r | Read. |
w | Write. |
x | Execute, and for a folder: enter. |
s | Setuid or setgid with execute (in the owner's or the group's place). |
S | Setuid or setgid without execute. |
t | Sticky bit with execute for others (in the others' place). |
T | Sticky bit without execute for others. |
- | Not set. |
Common modes
| Number | Letters |
|---|---|
644 | rw-r--r-- |
600 | rw------- |
664 | rw-rw-r-- |
640 | rw-r----- |
755 | rwxr-xr-x |
750 | rwxr-x--- |
700 | rwx------ |
775 | rwxrwxr-x |
777 | rwxrwxrwx |
1777 | rwxrwxrwt |
2775 | rwxrwsr-x |
4755 | rwsr-xr-x |
Sources
- Mode bits, what they allow, numeric modes and the letters of
ls -l: the GNU Coreutils manual, chapter File permissions and section What information is listed (coreutils v9.12). - The umask and the creation modes: the Linux man-pages project's umask(2) and mkdir(2) (commit ae6b221 of its mirror).
More Linux tools
-
Exit code, signal and errno lookup
Look up 137, 139, 143 or any other exit code, a signal such as SIGKILL, or an errno value such as 111.
-
curl error code lookup
Read curl: (6), (7), (28), (35), (60) or any other curl error, with libcurl's name and what to check.
-
OpenSSL verify errors and command builder
Read verify error:num=20 and the others in plain words, and build openssl commands for PFX, PEM and CSRs.
-
Cron expression explainer
Read a crontab line such as */15 8-18 * * 1-5 in words, see its next runs, or build a schedule.