chmod 555: what it means and when to use it
chmod 555 makes a file or directory readable and executable by everyone, with write permission removed for all three classes.
555
r-xr-xr-x
| Who | Digit | Read | Write | Execute |
|---|---|---|---|---|
| Owner | 5 |
Yes | No | Yes |
| Group | 5 |
Yes | No | Yes |
| Everyone else | 5 |
Yes | No | Yes |
How chmod 555 works
Each octal 5 combines read (4) and execute (1), omitting write (2). Even the file owner cannot overwrite a 555 file until they add write permission back.
Container builds, CI artifacts and shared CLI wrappers sometimes lock installed binaries to 555 so normal deployment scripts or interactive users cannot accidentally clobber them in place.
Where 555 belongs
- Locked-down shared binaries and CLI tools
- Read-only plugin or release directories
- Immutable-intent reference scripts inside containers
The command
Both of these set exactly the same permissions. The number is shorter; the letters are easier to read back later.
chmod 555 filename
chmod u=rx,g=rx,o=rx filename
Removing owner write does not stop root from modifying the file, nor does it stop someone with write permission on the parent directory from deleting or replacing it.