Skip to main content
ponderloop

Chmod Calculator: Octal, Symbolic and Checkbox Permissions

chmod 755 gives the owner read, write and execute and everyone else read and execute, which `ls -l` shows as rwxr-xr-x. The same mode in symbolic form is `chmod u=rwx,go=rx`. Each octal digit adds read (4), write (2) and execute (1) for the owner, group and others in turn, and a fourth leading digit adds setuid (4), setgid (2) and sticky (1). Tick the boxes, type octal, paste an `ls -l` string or a chmod command, or apply a change like `u+x,go-w` to a starting mode, and every other form updates.

Updated Runs in your browser: nothing you enter is uploadedHow this tool works

Permissions
Read (4)Write (2)Execute (1)
Owner
Group
Others

Type octal (755, 0644, 4755), an ls -l string (rwxr-xr-x, -rw-r--r--), a change like u+x,go-w, or a whole chmod command.

Result

Read “755” as an octal mode.

Octal
755
Octal, four digits
0755
Symbolic
rwxr-xr-x
As ls -l shows it
-rwxr-xr-x
chmod, numeric
chmod 755 file
chmod, symbolic
chmod u=rwx,go=rx file

What it means

  • Owner (u): read, write, execute
  • Group (g): read, execute
  • Others (o): read, execute

Common chmod modes

Octal mode, the ls -l text and the equivalent symbolic command for the modes you meet most.
ModeSymbolicchmod, symbolicTypical useWhat it allows
644rw-r--r--chmod u=rw,go=r fileOrdinary files: documents, web pages, configurationThe owner can read and write; everyone else can only read.
755rwxr-xr-xchmod u=rwx,go=rx filePrograms, scripts and directoriesThe owner can do everything; everyone else can read and run (or enter a directory).
600rw-------chmod u=rw,go= filePrivate files such as SSH keys and credentialsOnly the owner can read and write. ssh refuses a private key that is more open.
700rwx------chmod u=rwx,go= filePrivate directories and personal scripts (~/.ssh)Only the owner can read, write, run or enter.
777rwxrwxrwxchmod a=rwx fileAlmost neverWarning: every user can read, change and run it. A common “fix” for permission errors that hides the real problem and is a security hole on shared or web-facing systems.
1777rwxrwxrwtchmod ug=rwx,o=rwxt fileShared scratch directories such as /tmpEveryone can create files, but the sticky bit stops them deleting or renaming files that belong to others.
2775rwxrwsr-xchmod u=rwx,g=rwxs,o=rx fileA directory shared by a teamSetgid makes new files inherit the directory’s group; owner and group can write, others can only read and enter.
400r--------chmod u=r,go= fileRead-only secretsOnly the owner can read; nobody can write without changing the mode first.
4755rwsr-xr-xchmod u=rwxs,go=rx fileA program that must run as its owner (like passwd)Setuid: it runs with the owner’s privileges whoever starts it. Use sparingly.

Octal digits

Each digit is the sum of the bits you want: read 4, write 2, execute 1.
DigitBitsSymbolicAllows
0000---no permissions
1001--xexecute
2010-w-write
3011-wxwrite, execute
4100r--read
5101r-xread, execute
6110rw-read, write
7111rwxread, write, execute

What read, write and execute mean

The same bits do different things on a file and on a directory.
PermissionOn a fileOn a directory
Read (r, 4)View the contents.List the names inside (ls).
Write (w, 2)Change or truncate the contents.Create, delete and rename entries (needs execute too).
Execute (x, 1)Run it as a program or script.Enter it (cd) and reach files by name.

Special bits

The leading octal digit. In ls -l they replace the execute letter: lowercase when execute is also set, capital when it is not.
BitOctalShown asOn a fileOn a directory
Setuid4000s in the owner triad (rwsr-xr-x)Runs with the owner’s privileges.Ignored on Linux.
Setgid2000s in the group triad (rwxr-sr-x)Runs with the group’s privileges.New files inherit the directory’s group.
Sticky1000t in the others triad (rwxrwxrwt)Ignored on modern systems.Only a file’s owner (or the directory’s owner or root) may delete or rename it.

Symbolic changes worked out

Each change is applied to the starting mode shown. u is owner, g group, o others, a all; + adds, - removes, = sets exactly.
ChangeStarting modeResultResult, symbolicWhy
u+x644 (rw-r--r--)744rwxr--r--Make a script executable by its owner.
a+x644 (rw-r--r--)755rwxr-xr-xMake it executable for everyone (a means u, g and o).
go-w666 (rw-rw-rw-)644rw-r--r--Take write away from group and others.
u+x,go-w666 (rw-rw-rw-)744rwxr--r--Several clauses apply left to right, separated by commas.
a=r755 (rwxr-xr-x)444r--r--r--= replaces: everyone gets exactly read, nothing else.
g=u740 (rwxr-----)770rwxrwx---Copy the owner’s permissions to the group.
u=rwx,go=rx000 (---------)755rwxr-xr-xSet each class exactly: the symbolic form of 755.
a+X644 (rw-r--r--)644rw-r--r--X adds execute only if the file is a directory or already executable by someone: no change here.
a+X744 (rwxr--r--)755rwxr-xr-xThe owner already had execute, so X adds it for all.
g+s755 (rwxr-xr-x)2755rwxr-sr-xSet the setgid bit; shown as s in the group triad.
+t777 (rwxrwxrwx)1777rwxrwxrwtAdd the sticky bit, as on /tmp.

How to work out chmod permissions

  1. Add up each class. For the owner, the group and others, add read 4, write 2 and execute 1. Read and write is 4 + 2 = 6; read and execute is 4 + 1 = 5; all three is 7. Owner rwx, group r-x, others r-x is 755.
  2. Write the three digits. Put the owner’s digit first, then the group’s, then others’: chmod 755 file. Add a leading digit for special bits (4 setuid, 2 setgid, 1 sticky): chmod 2775 dir.
  3. Or change only what you need. Use symbolic mode to adjust a file without restating the rest: chmod u+x file adds owner execute and leaves everything else as it is; chmod go-w file removes write for group and others. Applied to 666, u+x,go-w gives 744.
  4. Read the ls -l output. The nine characters after the file type are three triads: owner, group, others. rwxr-xr-x is 755. An s or t replaces the execute letter for a special bit (rwsr-xr-x is 4755), and a capital S or T means the bit is set without execute.
  5. Check it before you run it. Run ls -l on the file afterwards. Avoid 777: if something fails with “permission denied”, fix the owner (chown) or the group, not the world-writable bit. Add -R only when you really want a whole tree changed.

Frequently asked questions

What does chmod 755 mean?
755 is rwxr-xr-x: the owner can read, write and execute (7 = 4 + 2 + 1), while the group and others can read and execute (5 = 4 + 1) but not write. It is the usual mode for programs, scripts and directories. The symbolic command is chmod u=rwx,go=rx file.
What does chmod 644 mean?
644 is rw-r--r--: the owner can read and write (6), the group and others can only read (4). It is the usual mode for ordinary files. The symbolic command is chmod u=rw,go=r file.
Is chmod 777 safe?
No. 777 (rwxrwxrwx) lets every user on the system read, change and run the file, and on a web server it can let an attacker who finds any foothold rewrite your code. It also usually hides the real problem. Give the file to the right owner or group with chown or chgrp and use 755 or 775 for directories and 644 or 664 for files. If many users must write to one directory, use setgid (2775) or the sticky bit (1777, as /tmp has) instead.
What are setuid, setgid and the sticky bit?
They are the three special bits, the leading octal digit. Setuid (4000) makes a program run as its owner, so 4755 shows as rwsr-xr-x. Setgid (2000) runs a program with its group, and on a directory makes new files inherit the directory’s group (2775 is rwxrwsr-x). The sticky bit (1000) on a directory stops users deleting each other’s files, so 1777 is rwxrwxrwt.
Why does ls -l show a capital S or T?
ls shows a lowercase s or t when the special bit and the matching execute bit are both set, and a capital S or T when the special bit is set but execute is not. 4644 shows as rwSr--r-- and 1776 as rwxrwxrwT. A capital letter is usually a mistake, because setuid without execute does nothing.
What is the difference between chmod 755 and chmod u=rwx,go=rx?
None, when you are setting all three classes: the numeric form states the whole mode in one number, and the symbolic form sets each class with = so it also replaces what was there. The symbolic form is easier to read and lets you change just one part (chmod g+w file), which the numeric form cannot do without knowing the current mode.
How do I make a file executable?
Use chmod +x file to let everyone run it, or chmod u+x file for the owner only. With no who letters, +x is limited by your umask, but the usual umask of 022 only blocks write, so +x adds execute for all three classes. Applied to 644, u+x gives 744 and a+x gives 755, the same as plain +x (755).
What does the capital X do in chmod?
X adds execute only if the target is a directory or already has execute for someone. It is meant for chmod -R a+rX dir: directories become enterable and files that were executable stay so, while plain files do not become executable. Applied to 644 it changes nothing (644); applied to 744 it gives 755.
Does chmod keep setgid on a directory?
GNU chmod does, in most cases: on a directory it preserves setuid and setgid unless you clear them explicitly with a symbolic mode such as g-s. A symbolic = clause (chmod g=rx dir) and a short numeric mode (chmod 755 dir) leave the bits as they were, so a setgid shared directory stays setgid. Tick “The target is a directory” to see this in symbolic changes; the result for a plain octal mode is the mode as typed, before this rule.
What does the calculator do with the umask?
Only a symbolic clause with no u, g, o or a is affected: for those, chmod leaves out any permission the umask would deny, so +w with the default 022 adds write for the owner but not for group and others. Clauses with who letters, octal modes and ls-style strings ignore the umask. Change the umask field to match your shell (umask prints it).

How it works

The Mode field is read as one of four forms. Digits only are an absolute octal mode of up to four digits (leading zeros allowed). Nine characters, or ten with a leading file-type character, are an ls -l string: each position must be r, w, x or - (and s, S, t or T where a special bit can appear), and s or t means the special bit and execute are both set while S or T means the special bit alone. A line starting with chmod is reduced to its mode argument by skipping options like -R and the file names. Anything else is read as a symbolic mode and applied to the starting mode you give, following POSIX chmod: clauses are separated by commas and applied left to right; each has optional who letters (u, g, o, a), then one or more actions, an operator (+, - or =) with permissions r, w, x, X, s, t or a single letter u, g or o to copy that class’s current permissions. + adds, - removes, and = clears everything the who letters cover (including that class’s setuid, setgid or sticky bit) before adding the new permissions. As GNU chmod does, o also covers the sticky bit, s applies to u and g only, and a clause with no who letters is limited by the umask. X adds execute if the target is marked as a directory or any execute bit is already set. The generated symbolic command sets u, g and o with = (merging classes with identical permissions), so it reproduces the mode from any starting point. Two things are not modelled: a few systems clear setuid and setgid when a file is written or chowned, and GNU chmod keeps a directory’s setuid and setgid bits when it is given a short numeric mode (chmod 755 dir leaves setgid on); clear them with a symbolic mode such as g-s. The calculator follows the same rule for symbolic changes when “The target is a directory” is ticked: = leaves a directory’s setuid and setgid bits alone unless you name them or remove them with -s. A numeric mode typed here is shown exactly as written, because the tool does not know the directory’s current mode. Everything runs in your browser; nothing you type is sent anywhere.

Sources

All toolsHome & DIY calculators