DevToolsmith

Chmod 555

chmod 555 sets the permissions to r-xr-xr-x: it lets everyone read and execute, but nobody write. Here is exactly what that allows on files and directories, when to use it, and the commands to apply it.

Runs 100% in your browser — nothing is uploaded

ClassreadwriteexecuteValue
owner5
group5
others5
Common:
$ chmod 555 file.sh
$ chmod u=rx,g=rx,o=rx file.sh
  • • The owner can read and execute.
  • • The group can read and execute.
  • • Everyone else can read and execute.

What chmod 555 means

WhoDigitLettersOn a fileOn a directory
owner 5 r-x Can read and run Can list files and enter it and open files
group 5 r-x Can read and run Can list files and enter it and open files
others 5 r-x Can read and run Can list files and enter it and open files

Each digit is the sum of read (4), write (2) and execute (1). In ls -l output it looks like this:

$ ls -l
dr-xr-xr-x  2 alice  staff  4096 Oct 21 10:30 example-dir
  • The owner can read and execute.
  • The group can read and execute.
  • Everyone else can read and execute.

When to use 555

  • Read-only directories
  • System binaries on some distributions

555 removes write access for everyone, including the owner. On a directory, nobody can add, delete or rename files inside, which is handy for directories that should never change at runtime. The owner can still restore write access with chmod, so it protects against accidents, not attacks.

Is chmod 555 safe?

Yes, for read-only directories. Other users can read and execute it, but can’t change it. Don’t use it for files that contain secrets.

Commands

# One file or directory
chmod 555 path

# Same thing in symbolic form
chmod u=rx,g=rx,o=rx path

# Every directory under a tree (leaves files alone)
find /path/to/dir -type d -exec chmod 555 {} +

# Check the result
stat -c '%a %A %n' path    # Linux
stat -f '%Lp %Sp %N' path  # macOS

Avoid chmod -R 555 on a whole tree: it gives files and directories the same mode. The find form above changes only directories.

Compare with similar modes

ModeSymbolicDifference
755 rwxr-xr-x Lets the owner do everything and everyone else read and execute

Other chmod values

777 · 775 · 770 · 755 · 751 · 750 · 744 · 711 · 700 · 666 · 664 · 660 · 644 · 640 · 600 · 500 · 444 · 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 555 mean?

chmod 555 sets the permissions to r-xr-xr-x. The owner can read and execute. The group can read and execute. Everyone else can read and execute.

Is chmod 555 safe?

Yes, for read-only directories. Other users can read and execute it, but can’t change it. Don’t use it for files that contain secrets.