chmod 444 — what r--r--r-- means
444
r--r--r--
Everyone can read; nobody — not even the owner — can write or execute.
Permission breakdown
When to use 444
- Freeze-protecting a file against accidental edits. 444 (
r--r--r--) strips every write bit, so even the owner cannot overwrite the file without first runningchmod +w. It is the classic way to bolt down a finished config, a generated artifact, or a reference document you never want a stray editor save or script to clobber. - Public read-only data that everyone may see but no one should change. A shared lookup table, a license file, a checked-in
VERSIONstamp, or vendored data living where all users can read it — 444 says "read freely, modify never." - Immutable build outputs. Files emitted by a deterministic build (lockfiles, compiled assets, snapshots) set to 444 surface accidental in-place edits immediately: the write fails instead of silently diverging from the source that produced them.
- Tripwire for tamper detection. Setting a sensitive but non-secret file to 444 means any process that tries to rewrite it errors out, giving you a cheap signal that something tried to modify a file that was supposed to stay fixed.
Common mistakes & gotchas
- 444 does not protect a file from deletion or replacement. Write permission on the parent directory, not on the file, controls whether a file can be removed or renamed. Someone with write access to the directory can
rmyour 444 file and drop a new one in its place. For real immutability usechattr +i(Linux) or lock down the directory. - root ignores 444 entirely. The owner can simply
chmod u+wand write, and the root user bypasses the read-only bits altogether. 444 prevents accidents, not a determined privileged actor — treat it as a guardrail, not a security control. - 444 on a directory is almost always a mistake. A directory with no execute bit cannot be entered or traversed, so you can
lsthe name but notcdinto it or reach anything inside. Read-only directories want 555, not 444. - It is readable by everyone — never use it for secrets. 444 grants read to group and others, so a file with passwords, tokens, or keys is fully exposed. Secrets that should merely be unchangeable still belong at 400 or 440, where the read is also restricted.
444 vs the alternatives
- 555 (
r-xr-xr-x) is 444 plus the execute bit for everyone. Use 555 for read-only directories (so they can be entered) and for executables you want locked against edits; use 444 for plain data files that should never run. - 644 (
rw-r--r--) is the normal read-only-to-others default but keeps write for the owner. Choose 644 for files you still maintain; step down to 444 only when you specifically want to block even the owner's own accidental saves. - 400 (
r--------) restricts the read to the owner alone. Use 400 when the content is private; use 444 when the content is public and the only goal is to make it unchangeable.
Set it with chmod
Apply this permission to a single file:
chmod 444 filename
Or apply it recursively to a directory and everything inside it:
chmod -R 444 directory/
The same thing in symbolic form:
chmod u=r,g=r,o=r filename
Frequently asked questions
What does chmod 444 mean?
chmod 444 sets permissions to r--r--r--: the owner, the group, and everyone else can read the file, but no one can write to or execute it. It makes a file read-only for all users.
How do I edit a file that is set to 444?
First restore write permission, e.g. chmod u+w file (or chmod 644 file), make your edit, then optionally set it back to 444. The owner can always change the mode even though the write bit is off.
Does 444 stop a file from being deleted?
No. Deletion and renaming are governed by write permission on the parent directory, not the file's own bits. A 444 file in a writable directory can still be removed. Use chattr +i or restrict the directory for true immutability.
What is the difference between 444 and 644?
644 lets the owner write; 444 removes write for everyone including the owner. Use 444 specifically when you want the file frozen against all modification, not just protected from other users.
Other common permissions
Or build any permission with the interactive chmod calculator.