What chmod 444 means
| Who | Digit | Letters | On a file | On a directory |
|---|---|---|---|---|
| owner | 4 |
r-- |
Can read | Can list files |
| group | 4 |
r-- |
Can read | Can list files |
| others | 4 |
r-- |
Can read | Can list files |
Each digit is the sum of read (4), write (2) and execute (1). In
ls -l output it looks like this:
$ ls -l
-r--r--r-- 1 alice staff 1834 Oct 21 10:30 example.txt
- The owner can read.
- The group can read.
- Everyone else can read.
When to use 444
- Read-only reference files
- Files you want to protect from accidental edits
With 444, editors warn before saving and rm asks for confirmation (unless -f is used). It is a light way to mark files like migration snapshots or generated lockfiles as “don’t touch”.
Is chmod 444 safe?
Yes, for read-only reference files. Other users can read it, but can’t change it. Don’t use it for files that contain secrets.
Commands
# One file
chmod 444 file
# Same thing in symbolic form
chmod u=r,g=r,o=r file
# Every file under a tree (leaves directories alone)
find /path/to/dir -type f -exec chmod 444 {} +
# Check the result
stat -c '%a %A %n' file # Linux
stat -f '%Lp %Sp %N' file # macOS
Avoid chmod -R 444 on a whole tree: it gives files and directories the same mode. The
find form above changes only files.
Compare with similar modes
| Mode | Symbolic | Difference |
|---|---|---|
744 |
rwxr--r-- |
Gives the owner full access and everyone else read-only access |
644 |
rw-r--r-- |
Lets the owner read and write, and everyone else only read |
Other chmod values
777 · 775 · 770 · 755 · 751 · 750 · 744 · 711 · 700 · 666 · 664 · 660 · 644 · 640 · 600 · 555 · 500 · 400 · 000 · 1777 · 2775 · 4755
Need a different combination? Use the Chmod Calculator.
Sources
Spotted a mistake? Email hello@devtoolsmith.com and we’ll fix it.
Frequently asked questions
What does chmod 444 mean?
chmod 444 sets the permissions to r--r--r--. The owner can read. The group can read. Everyone else can read.
Is chmod 444 safe?
Yes, for read-only reference files. Other users can read it, but can’t change it. Don’t use it for files that contain secrets.