Chmod Calculator: Unix File Permissions

Tick read, write and execute for owner, group and others to get the chmod number, the ls -l letters and the command.

Work out Unix and Linux file permissions. Tick read, write and execute for the owner, the group and everyone else, and see the number chmod uses (such as 755), the letters ls -l shows (rwxr-xr-x) and a plain sentence saying who can do what. Or type a mode, either digits like 644 or 0750 or letters copied from ls -l, to decode it. Setuid, setgid and the sticky bit are covered too, shown as s, S, t and T the way ls prints them. Ready-made commands are written for the file name you type: chmod with the number, chmod with letters (u=rwx,g=rx,o=rx), chmod -R for a folder and everything in it, and a find command that changes only folders. A list of common modes explains when to use each, and a umask box shows what permissions new files and folders get. The Linux Command Cheatsheet covers the commands around it.

A number like 755 or 0644, or letters like rwxr-xr-x (from ls -l).

WhoRead (4)Write (2)Execute (1)Digit
Owner7
Group5
Others5
Number
755
As ls -l shows it
-rwxr-xr-x
  • Owner can read, write, execute.
  • Group can read, execute.
  • Others (everyone else) can read, execute.

Commands

Number
chmod 755 file.txt
Letters
chmod u=rwx,g=rx,o=rx file.txt
A folder and everything in it
chmod -R 755 file.txt
Only folders under here (files untouched)
find file.txt -type d -exec chmod 755 {} +

Common modes

The mask new files and folders start from. 022 is the usual default.

New files get 644 (rw-r--r--) and new folders get 755 (rwxr-xr-x).

Common use cases

  • Fix a permission denied error on a server or script
  • Set safe permissions for SSH keys and .env files
  • Decode the letters ls -l shows
  • Prepare for a Linux course or exam

How to use

  1. Tick the boxes, or type a mode such as 755 or rwxr-xr-x.
  2. Read the explanation of who can do what.
  3. Type your file or folder name.
  4. Copy the command you need.

FAQ

How do chmod numbers work?

Each digit is one set of people, owner, group and others, made by adding read (4), write (2) and execute (1). 7 is all three, 5 is read and execute, 4 is read only, so 755 means the owner can do everything and everyone else can read and run.

What does 644 mean?

The owner can read and change the file; everyone else can only read it. It's the usual setting for ordinary files and web pages.

Why shouldn't I use 777?

It lets every user on the machine change or replace the file. On a web server that's a common way in for attackers; 755 or 775 usually does the job.

What does execute mean on a folder?

On a folder, execute (x) means being allowed to open it and reach the files inside. Folders usually need it, which is why they're 755 while files are 644.

What are setuid, setgid and sticky?

Setuid makes a program run as its owner, setgid runs it as its group (or, on a folder, gives new files the folder's group), and sticky stops people deleting each other's files in a shared folder like /tmp.