Workflow Tools Control Yard

Home / Linux

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.

Permissions as check boxes
WhoReadWriteExecute
Owner
Group
Others
Special bits

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.

ValueBitOn a fileOn a folder
4000Set user ID (setuid)The program runs with the file owner's rights.On a few systems, new files get the folder's owner.
2000Set 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.
1000Sticky 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.
400Owner: readRead the file.List the folder.
200Owner: writeChange the file.Create, delete and rename files inside.
100Owner: executeRun the file as a program.Enter the folder and open what is inside.
40Group: readAs for the owner.As for the owner.
20Group: writeAs for the owner.As for the owner.
10Group: executeAs for the owner.As for the owner.
4Others: readAs for the owner.As for the owner.
2Others: writeAs for the owner.As for the owner.
1Others: executeAs 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:

LetterWhat it means
rRead.
wWrite.
xExecute, and for a folder: enter.
sSetuid or setgid with execute (in the owner's or the group's place).
SSetuid or setgid without execute.
tSticky bit with execute for others (in the others' place).
TSticky bit without execute for others.
-Not set.

Common modes

NumberLetters
644rw-r--r--
600rw-------
664rw-rw-r--
640rw-r-----
755rwxr-xr-x
750rwxr-x---
700rwx------
775rwxrwxr-x
777rwxrwxrwx
1777rwxrwxrwt
2775rwxrwsr-x
4755rwsr-xr-x

Sources

More Linux tools