Skip to content

chmod 555

chmod 555 sets r-xr-xr-x: the owner, the group and everyone else can read and execute (list and enter a directory), and no one can write to it.

Permission matrix

Which permission bits each class has
WhoRead (4)Write (2)Execute (1)Digit
Owner (u)YesNoYes5
Group (g)YesNoYes5
Others (o)YesNoYes5

Execute means different things by type. On a file it lets the kernel run it as a program. On a directory it is search permission: entering it (cd) and reaching the files inside by name. Read on a directory only lists names.

What each class can do with a file and with a directory
WhoOn a fileOn a directory
Owner (u)Read and runList, enter and open entries
Group (g)Read and runList, enter and open entries
Others (o)Read and runList, enter and open entries

Facts

Representations of this mode
Octal555 (0555)
Symbolicr-xr-xr-x
ls -l, file-r-xr-xr-x
ls -l, directorydr-xr-xr-x
Equivalent symbolic commandchmod a=rx
Default umask that creates itNone of the common umasks; set it explicitly with chmod
How Git records a file with it100755 (executable)
Special bitsNone

When to use it

  • Directories whose entries must not change: on Linux, /proc and /sys show as dr-xr-xr-x, and the kernel creates their contents itself.
  • Released builds or vendored tools that should never be edited in place; a write-protected tree turns an accidental edit or rm into an error instead of a silent change.

When not to use it

  • As protection against the owner or root: the owner can run chmod again at any time, and root ignores write permission entirely.
  • Directories an app writes caches or logs into: every write fails with permission denied.
  • Plain data files: the file-side twin is 444, without the execute bits.

Commands

Set it on one file or directory
chmod 555 release
chmod a=rx release   # same result
Check the result
stat -c '%a %A %n' release     # Linux (GNU stat): 555 dr-xr-xr-x
stat -f '%Lp %Sp %N' release   # macOS and BSD

Applying it to a whole tree

chmod -R would put the same mode on files and directories alike. Set directories to 555 and files to 444 separately:

find release -type d -exec chmod 555 {} +
find release -type f -exec chmod 444 {} +

Or in one pass with a capital X, which adds execute only to directories and to files that already had it: chmod -R a=rX release.

Git and the execute bit

Git stores only one permission fact per file: 100755 if the owner execute bit is set, 100644 otherwise. A file with this mode is committed as 100755; the group and others bits never reach the repository. On Windows, or where core.fileMode is false, set the bit with git update-index --chmod=+x.

Frequently asked questions

What does chmod 555 mean?
Owner 5 (read 4 + execute 1), group 5, others 5: r-xr-xr-x. Nobody has write.
Can I delete a file inside a 555 directory?
No. Creating, deleting and renaming entries needs write on the directory, and 555 has none. Root still can.
How do I make a 555 directory writable again?
As its owner, run chmod u+w on it (or chmod 755). Owners can always change the mode of their own files.

Last reviewed by Arielton Oberek.