/tmp does, so they can only delete their own).| Class | Read | Write | Execute | Special | Octal |
|---|---|---|---|---|---|
- Owner (u), group (g), others (o)
- Every file has one owning user and one group. The kernel checks only the first class that matches you: the owner gets the owner bits, members of the group get the group bits, and everyone else gets the others bits.
ameans all three. - Read, write, execute on a file
rreads the contents,wchanges them,xruns it as a program or script.- Read, write, execute on a directory
rlists the names inside,wcreates, renames and deletes entries (withx), andxlets you enter it and reach files by name. A directory almost always needsxwherever it hasr.- Special bits
- setuid (4000) runs a program with its owner's privileges, as
passwddoes; Linux ignores it on scripts. setgid (2000) runs with the group's privileges, and on a directory makes new files inherit its group. Sticky (1000) on a directory lets only a file's owner delete it, as on/tmp. In symbolic form they replace thex:s/twith execute,S/Twithout.
About the Chmod Calculator
This calculator converts Unix file permissions between the checkbox grid (read, write and execute for owner, group and others), the octal number (755, or 4755 with special bits) and the symbolic string that ls -l prints (rwxr-xr-x). It also writes the matching chmod command in octal and symbolic form.
The setuid, setgid and sticky bits are supported. In the symbolic string they replace the execute position: s or t when execute is also set, S or T when it isn't.
How to use it
- Tick the checkboxes, type an octal or symbolic mode, or click a preset.
- To change the current mode, type a relative expression such as
u+x,go-wora=rand press Apply. A full command likechmod 750 deploy.shworks too. - Tick "Directory" to see what the bits mean for a folder, then copy the command.
Examples
- 755: the usual mode for programs, scripts and directories.
- rwxr-xr--: parses the symbolic form, which is 754.
- Setuid on 755: shows
rwsr-xr-x, as on/usr/bin/passwd.
Common questions
What do the three digits mean?
Each digit is a sum: read is 4, write is 2 and execute is 1. The first digit is the owner, the second the group, the third everyone else, so 640 means owner read and write, group read, others nothing.
Why can't I open a directory that has read permission?
Listing names needs r, but entering the directory and opening files inside it needs x. Directories normally get 755 or 750, files 644 or 640.
Does chmod 755 clear setgid on a directory?
GNU chmod keeps a directory's setuid and setgid bits when you give a 3-digit mode. Use g-s or a 5-digit mode such as 00755 to clear them.
Related tools
- Binary, Hex & Decimal Converter: see the octal digits in binary.
- cURL to Code Converter: turn shell commands into code.
- Cron Expression Parser: check the schedule of the script you just made executable.