HomeDeveloper & IT › Unix Permissions Calculator

Unix Permissions Calculator

Converts a Unix/Linux file mode between octal (755, 0644, 4755) and symbolic (rwxr-xr-x, -rw-r--r--, u=rwx,g=rx,o=rx) notation and explains the read/write/execute bits for owner, group and others plus the setuid, setgid and sticky bits.

When to use

You need the chmod command for a permission string seen in ls -l, or want to know what an octal mode such as 4755 grants.

Do not use when: You need ACLs (getfacl/setfacl), Windows NTFS permissions, or umask arithmetic (subtract the umask bits from 666/777 manually).

Formula

digit = 4·read + 2·write + 1·execute for owner, group, others; special digit = 4·setuid + 2·setgid + 1·sticky; mode = special·512 + owner·64 + group·8 + others

Follows the POSIX mode bits as documented in the GNU coreutils manual; an uppercase S or T in a symbolic string means the special bit is set without the corresponding execute bit.

Inputs

ParameterTypeUnitRequiredDescription
modestringyesOctal mode with 3 or 4 digits (755, 0644, 4755, 0o755), a 9-character symbolic string optionally preceded by a file-type character (rwxr-xr-x, -rw-r--r--, drwxr-sr-x), or chmod assignments (u=rwx,g=rx,o=rx).

Outputs

OutputTypeUnitDescription
octalstringThree digits, or four when setuid/setgid/sticky are set (e.g. 4755).
symbolicstringNine characters as shown by ls -l (s/S and t/T mark the special bits).
ownerstringPermissions of the file owner.
groupstringPermissions of the owning group.
othersstringPermissions of everyone else.
setuidbooleanExecutable runs with the owner's user id (octal 4000).
setgidbooleanExecutable runs with the group id; new files in a directory inherit its group (octal 2000).
stickybooleanOnly a file's owner may delete or rename it inside the directory (octal 1000).
chmod_commandstringEquivalent chmod command with the octal mode.
chmod_symbolicstringEquivalent chmod command using u=, g=, o= assignments.
explanationstringHow each octal digit is built from read (4), write (2) and execute (1).

Example

755: {"mode":"755"}{"octal":"755","symbolic":"rwxr-xr-x","owner":"read, write, execute","group":"read, execute","others":"read, execute","setuid":false,"chmod_command":"chmod 755 file","chmod_symbolic":"chmod u=rwx,g=rx,o=rx file"}

rw-r--r--: {"mode":"rw-r--r--"}{"octal":"644","symbolic":"rw-r--r--","owner":"read, write","group":"read","others":"read","sticky":false,"chmod_command":"chmod 644 file"}

GET https://tttkmbb.com/api/v1/calculate/unix-permissions?mode=755

Machine access

Sources

FAQ

What does the leading digit in 4755 mean?

The fourth (leading) digit holds the special bits: 4 = setuid, 2 = setgid, 1 = sticky. 4755 is rwsr-xr-x: everyone can run the program with the owner's privileges, as with /usr/bin/passwd.

What is the difference between 755 and 0755?

None; the leading 0 is the C/shell octal prefix. 0o755 (JavaScript/Python style) is accepted too.

Why does ls show a capital S or T?

A capital letter means the special bit is set but the execute bit in that position is not (e.g. rw-r-Sr-- = 2644), which is usually a mistake.

Related calculators