Linux chmod Command: A Complete Permissions Guide

Published 2026-08-05 · Learn Linux

The chmod command changes who can read, write and execute a file or directory. Permissions are written two ways: as three numbers such as chmod 644 file, or as letters such as chmod u+x file. This guide explains both and shows when to use each.

Read an ls -l permission line

Run ls -l and each file starts with ten characters like -rw-r--r--. The first shows the type, then three groups of three: owner (u), group (g), everyone else (o). Each group shows r read, w write, x execute, or - when the permission is missing.

$ ls -l script.sh

The octal codes: 644 and 755

Each permission group is one number: read counts 4, write counts 2, execute counts 1, and you add them. So 7 means rwx, 6 means rw, 5 means rx, and 4 means read-only. 644 (owner rw, group r, others r) is standard for files; 755 (owner rwx, group rx, others rx) is standard for scripts and directories.

$ chmod 644 notes.txt
$ chmod 755 run.sh

The symbolic modes

Symbolic mode changes just one part: the target (u, g, o, or a for all), the operator (+ add, - remove, = set exactly) and the permission. u+x makes a file executable for you without touching anything else.

$ chmod u+x run.sh
$ chmod g-w notes.txt

Apply to a whole directory tree

Use -R (recursive) with the directory. A common pattern for a web folder is 755 on directories and 644 on files.

$ chmod -R 755 project/

When do you need execute?

Files need execute only if you run them directly, like scripts. Config files and documents do not. To change who owns a file rather than its permissions, see chown and the user management guide. The chmod reference page covers special modes like setuid.

Keep learning

Related guides: Linux User Management: useradd, usermod and passwd · The Linux ls Command: List Files Like a Pro · How to Copy Files and Directories with the Linux cp Command. Read all tutorials on the Learn Linux blog.