Skip to content

Chmod Calculator (Unix Permissions)

Convert Unix file permissions between octal (755, 644) and symbolic (rwxr-xr-x), with setuid, setgid, sticky bit, chmod commands and umask defaults.

Calculator Details

Symbolic (ls -l):-rwxr-xr-xSee results ↓

Octal (755, 0644, 4755) or symbolic (rwxr-xr-x, -rw-r--r--, drwxrwxrwt)

Sets the first character of the ls -l string and what x means (run, or open the folder)

Or tick the permissions

Owner

Group

Others

Special

Your Results

Symbolic (ls -l): -rwxr-xr-x

Symbolic (ls -l)

-rwxr-xr-x

Octal 755

Command

chmod 755 filename

Symbolic command

chmod u=rwx,g=rx,o=rx filename

New files with umask 022

644

rw-r--r--; directories 755 (rwxr-xr-x)

Mode 755 is -rwxr-xr-x in ls -l: set it with "chmod 755 filename" or "chmod u=rwx,g=rx,o=rx filename".

Detailed Breakdown

Permissions of 755
WhoRead (4)Write (2)Execute (1)DigitSymbolic
Owner (u)yesyesyes7rwx
Group (g)yesnoyes5r-x
Others (o)yesnoyes5r-x
Special bits (the optional first octal digit)
BitSetAdds
Set user ID (4000)no4
Set group ID (2000)no2
Sticky bit (1000)no1

How This Calculator Works

How it's calculated

each digit = read 4 + write 2 + execute 1 · digits in the order owner, group, others

optional first digit = setuid 4 + setgid 2 + sticky 1

new file = 666 minus the umask bits · new directory = 777 minus the umask bits

Your numbers: Owner (u) rwx = 7; Group (g) rx = 5; Others (o) rx = 5. Together that is 755, shown by ls -l as -rwxr-xr-x. With umask 022, new files start at 644 and new directories at 755.

Frequently Asked Questions

What does chmod 755 mean?

The owner can read, write and execute (7 = 4 + 2 + 1); the group and everyone else can read and execute (5 = 4 + 1) but not change the file. ls -l shows it as -rwxr-xr-x. It is the usual mode for programs, scripts and directories that others need to open.

What does chmod 644 mean?

The owner can read and write (6 = 4 + 2); the group and others can only read (4). ls -l shows -rw-r--r--. It is the usual mode for ordinary files such as web pages, images and configuration that isn’t secret.

How do I convert rwxr-xr-x to a number?

Split it into three groups of three (rwx, r-x, r-x) and add 4 for r, 2 for w and 1 for x in each group: 4 + 2 + 1 = 7, 4 + 0 + 1 = 5, 4 + 0 + 1 = 5, so 755. If the string has 10 characters, the first one is the type (- for a file, d for a directory) and isn’t part of the mode.

Is chmod 777 safe?

Rarely. 777 lets every user on the system change or replace the file, so any compromised account or service can modify it. Fix the owner or group (chown, chgrp) and give write access only to those who need it. Shared directories that everyone writes to, like /tmp, use 1777 so the sticky bit stops users deleting each other’s files.

What are setuid, setgid and the sticky bit?

They are the optional first octal digit. Setuid (4) runs a program with its owner’s rights, shown as s in the owner’s execute position. Setgid (2) runs it with the file’s group, or on a directory makes new files inherit the directory’s group. The sticky bit (1) on a directory lets only a file’s owner delete it, shown as t. A capital S or T means the bit is set without execute.

What permissions should an SSH private key have?

600 (-rw-------): readable and writable by you only. OpenSSH refuses to use a private key that the group or others can read. The ~/.ssh directory itself is usually 700 and authorized_keys 600 or 644.

What is a umask?

A mask of permission bits that are removed when a program creates a file or directory. Files start from 666 and directories from 777, so the common umask 022 gives 644 files and 755 directories, and 077 gives 600 and 700. Open the advanced options to try a different umask.

Included: the POSIX permission bits (read, write and execute for owner, group and others), setuid, setgid and the sticky bit, octal and ls -l forms in both directions, absolute chmod commands, and the default modes a umask leaves for new files (666) and directories (777). Left out: relative symbolic changes such as u+x or g-w (they depend on the file's current mode), access control lists (the + after the mode in ls -l), SELinux and other security labels, file types other than files and directories (links, devices, sockets), and Windows permissions.

Chmod Calculator: Octal and Symbolic Unix Permissions

By FindMySum · Last reviewed

A chmod calculator converts Unix file permissions between the two ways they are written: an octal number such as 755 and the symbolic string such as rwxr-xr-x that ls -l prints. Type either form, or tick the boxes, and it gives the other, the matching chmod commands and what each part means. It also shows the modes a umask leaves on new files and directories.

Three classes, three permissions

Every file on Linux, macOS and other Unix-like systems has an owner and a group. Its mode says what three classes of user may do:

  • Owner (u): the user who owns the file.
  • Group (g): members of the file's group.
  • Others (o): everyone else.

For each class there are three permissions. Read (r) lets you read a file or list a directory. Write (w) lets you change a file, or create and delete names in a directory. Execute (x) lets you run a file as a program, or open a directory and reach the files in it.

From letters to digits

Each permission has a value: read 4, write 2, execute 1. Add the values a class has and you get one octal digit from 0 to 7:

DigitLettersMeaning
7rwxread, write, execute
6rw-read, write
5r-xread, execute
4r--read only
0---nothing

Write the digits in the order owner, group, others. The default in the calculator is 755: the owner has 7 (rwx), and the group and others have 5 (r-x). ls -l shows a file with that mode as -rwxr-xr-x, where the first character is the type: - for a regular file, d for a directory.

To go the other way, split the nine letters into three groups and add the values. rw-r----- is 4 + 2, then 4, then nothing: 640, a common mode for files that a group of service accounts may read but nobody else.

The special bits

An optional fourth digit goes in front of the other three:

  • Setuid (4000). A program runs with its owner's rights instead of the rights of the user who started it. passwd uses it to update the password file. ls -l shows s in the owner's execute position.
  • Setgid (2000). A program runs with the file's group; on a directory, new files inherit the directory's group instead of the creator's main group, which keeps shared project folders consistent. Shown as s in the group's execute position.
  • Sticky bit (1000). On a directory, only a file's owner (or the directory's owner, or root) may delete or rename it, even if others can write to the directory. /tmp is 1777: drwxrwxrwt.

A capital S or T means the special bit is set but the execute bit under it is not. On a regular file that usually signals a mistake, and the calculator flags it.

Two ways to write the command

The calculator gives two chmod commands for the same mode. The octal one, chmod 755 filename, replaces the whole mode in one go. The symbolic one, chmod u=rwx,g=rx,o=rx filename, sets each class with =. Both leave the file in exactly the same state. Symbolic mode also has + and - to add or remove single permissions, such as chmod g+w to let the group write. Those depend on the file's current mode, so the calculator doesn't convert them.

umask: the starting point for new files

Programs normally ask for mode 666 when they create a file and 777 when they create a directory. The umask removes bits from that request. With the usual umask 022, the write bit for group and others is removed, so new files get 644 and directories 755. A umask of 002, common on systems that give every user their own group, gives 664 and 775. A strict 077 gives 600 and 700: only you can see what you create. The umask only takes bits away; it never adds execute to a file.

Choosing permissions

Some modes that come up again and again:

  • 644 for ordinary files and 755 for programs and directories that others need to read.
  • 600 for private files such as SSH keys and 700 for private directories such as ~/.ssh.
  • 640 / 750 when a service's group needs read access and others need none.
  • 2775 for a shared team directory, so new files keep the team's group.
  • 1777 for a shared scratch directory where everyone can write but nobody can delete other people's files.

Avoid 777 and 666 on anything that matters. If a program needs to write a file, give the program's user ownership, or put it in the right group and grant group write, instead of opening the file to every account on the machine.

More questions

Why does a directory need execute permission?

On a directory, execute means search: permission to open the directory and reach the files inside it by name. Read lets you list the names; without execute you can see them but not open them. That is why directories are usually 755 or 700 rather than 644 or 600.

What is the difference between chmod 755 and chmod u=rwx,g=rx,o=rx?

Nothing in the result: both set the mode to rwxr-xr-x. The octal form always replaces the whole mode. The symbolic form with = also sets each class completely, while + and - change only the bits you name and leave the rest as they were, which is handy in scripts.

How do I change permissions on every file in a folder?

chmod -R applies a mode recursively, but one mode rarely suits both files and directories. A common pattern is find dir -type d -exec chmod 755 {} + for directories and find dir -type f -exec chmod 644 {} + for files. The capital X in symbolic mode (chmod -R a+X dir) adds execute only to directories and to files that already have it.

Can I see a file's mode as a number?

Yes. On Linux, stat -c '%a %n' file prints the octal mode (for example 644 file); on macOS and BSD use stat -f '%Lp %N' file. ls -l shows the symbolic form, which this calculator converts.

Do file permissions apply to the root user?

Mostly not. The superuser can read and write any file regardless of its mode. Execute is the exception: root can run a file only if at least one execute bit is set. Permissions protect users from each other, not from an administrator.

Sources

This article explains how the calculator works and is general information, not financial, tax, legal or medical advice. Rules change; check the sources above or a qualified professional before you act.

Spotted a wrong result or a bug? Report a problem

May we count your visits with Invoker Analytics? It keeps a random visitor number in your browser. Your calculator inputs are never sent. Privacy policy