Articles
Published · November 18, 2026

File Permissions Explained: Reading rwxr-xr-x and chmod Modes

A permission string like rwxr-xr-x is three sets of read, write, and execute, for the owner, the group, and everyone else. chmod 755 is the same thing in numbers.

Also in: Español中文हिन्दी

A string like rwxr-xr-x lists who may read, write, and run a file, in three groups of three. chmod 755 sets exactly that string using numbers. Once you can read one, you can read the other, and the "permission denied" message after you save a script stops being a mystery.

Reading the ten characters of rwxr-xr-x

Run ls -l and each line starts with a string like this:

-rwxr-xr-x  1 you  staff  212 Nov 18 09:30 backup.sh

Wikipedia's article on file-system permissions explains that the first character is the file type, not a permission. A dash means a regular file, and d means a directory. The other nine characters are the permissions.

Those nine are three groups, one for each class of user: the user (the owner), the group, and others (everyone else). POSIX defines these three classes and three operations: read, write, and execute. Each slot holds a letter if the permission is granted and a dash if it is not.

So -rwxr-xr-x is a regular file where the owner has rwx, and the group and others have r-x. They can read and run it, but only the owner can change it. A line like dr-x------ is a directory that only its owner can use, and only to read and enter.

Octal modes: how 755 and 644 add up

Each letter has a value: read is 4, write is 2, execute is 1. Add up the ones you want for each class and you get one digit. Three classes make three digits.

For rwxr-xr-x:

  • Owner rwx is 4 + 2 + 1 = 7
  • Group r-x is 4 + 0 + 1 = 5
  • Others r-x is 4 + 0 + 1 = 5

That gives 755. The chmod manual page describes a numeric mode as one to four octal digits made by adding the values 4, 2, and 1, with omitted digits treated as leading zeros. The optional fourth digit, at the front, holds the special bits covered below.

A few modes you will meet often:

| Mode | String | Typical use | |------|--------|-------------| | 755 | rwxr-xr-x | Scripts and directories | | 644 | rw-r--r-- | Plain text and config files | | 600 | rw------- | Private files, only you can read | | 740 | rwxr----- | Owner full, group read only | | 777 | rwxrwxrwx | Everyone can do everything |

Don't reach for 777 as a fix. If a file needs to run, give the owner execute and leave the rest alone.

Symbolic modes: operators and letters

Numbers replace every permission at once. Symbolic modes change only what you name. The syntax from the chmod manual page is a "who", an operator, and the permissions:

  • Who: u for the owner, g for the group, o for others, a for all
  • Operator: + adds, - removes, = sets exactly
  • Permissions: r, w, x, and a few more
chmod u+x backup.sh        # let the owner run it
chmod go-w notes.txt       # remove write from group and others
chmod a=r readme.txt       # everyone reads, nobody writes
chmod u=rwx,go=rx backup.sh   # same as chmod 755

Separate several changes with commas. If you leave out the who-letter, chmod acts as if you typed a, except that bits set in your umask are not affected.

The capital X is handy for recursive changes. It sets execute only on directories, or on files that already have execute for someone. So chmod -R u+rwX,go+rX project/ opens up a folder tree without turning every text file into a program.

What r, w, and x mean on directories

On a directory the three letters mean something different, and that trips people up:

  • r lets you list the names inside.
  • w lets you create, delete, and rename entries.
  • x lets you search the directory, which means reaching the items inside by name.

Without x, a directory blocks access to its contents, and w does very little without it. That is why directories are usually 755, not 644: a 644 folder lists its names but cannot be entered.

Three special bits live in an optional leading digit. Setuid and setgid run a program as its owner or group. On a directory, setgid makes new items inherit the directory's group. The sticky bit on a directory stops people deleting or renaming files they do not own, which is why you see it on /tmp.

Making a script executable on a Mac

A text file you save is usually 644, so it cannot run as a program. Apple's Terminal guide says shell scripts must be executable to run, and gives two steps: cd to the folder, then chmod 755 YourScriptName.sh. After that you can run it with ./YourScriptName.sh.

If you write scripts by hand, shell here documents are a neat way to produce multi-line text from them. And if you want to run one on a timer, see scheduling a script on a Mac.

umask: where default permissions come from

New files do not start at 777. Apple's umask article says the umask value is subtracted from a default, usually 666 for files and 777 for folders. With a umask of 022, new files get 644 and new folders get 755.

That is why a script you create isn't executable until you chmod it. If you want a custom umask, you set it in your shell setup, so it helps to know which zsh startup file runs when.

How Carets fits in

Scripts, config files, and notes are all plain text, and Carets is a native notes and code editor for iPhone, iPad, and Mac that handles them in one place.

  • Syntax highlighting. Shell scripts and config files get highlighting, which helps when you are checking a chmod line in a README.
  • Files, projects, and tags. Keep a script, its notes, and a permissions cheat sheet together in one project.
  • Portable files. Everything stays plain text, so the same files work in Terminal on a Mac.

Carets edits the file; it doesn't change permissions. You still run chmod in Terminal. Get Carets on the App Store for iPhone, iPad, and Mac.

Frequently Asked Questions

What does -rwxr-xr-x mean?

A regular file (the leading dash) where the owner can read, write, and execute, and the group and everyone else can read and execute. In octal it is 755.

What is the difference between chmod 755 and chmod 644?

755 gives the owner read, write, and execute and everyone else read and execute, which suits scripts and directories. 644 drops execute for everyone, which suits plain text and config files.

Why does a directory need the x permission?

On a directory, x means search. Without it you cannot reach the files inside, and write permission does little because you cannot work with the entries.

What does capital X do in chmod?

It sets execute only on directories, or on files that already have execute for some user, so a recursive change does not turn every text file into a program.