chmod 000: No Permissions for Anyone, and What Still Works
000 is ----------: no class has read, write or execute. It is used to take a file out of service temporarily, and it stops unprivileged accounts only, because root ignores the mode and the owner can always restore it.
At a glance
- Octal
- 000, written 0000 in four digit form
- Symbolic
- u=,g=,o=
- On a file
- ----------
- On a directory
- d---------
- Owner
- Nothing, except the right to change the mode back
- Group
- Nothing
- Others
- Nothing
In detail
000 is the quarantine mode. Setting it on a file takes that file out of service for every unprivileged account at once without deleting it, which is useful when you want to stop something being read or executed while you work out whether it should exist at all. The file, its contents and its timestamps are untouched.
Three things still work afterwards, and all three surprise people. Root reads and writes it regardless, because a privileged process bypasses the permission check entirely. The owner can restore any mode at will, since chmod is authorised by ownership. And the file can still be deleted by anyone with write permission on the containing directory, because removal is a directory operation.
That last point is worth stating plainly: 000 does not protect a file from being removed. If the goal is to stop deletion, the control is the directory mode, or the sticky bit on a shared directory, or the immutable attribute set with chattr +i, which even root must clear first.
On a directory, 000 blocks listing and traversal for everyone unprivileged, which makes the entire subtree unreachable regardless of how open the modes inside are. It is an effective way to shut off a path, and an easy way to break a service in a manner that produces no useful log line anywhere, so record what you did before you walk away from it.
As a permanent state it is a smell. A file nobody can read is either something that should have been removed or something whose access should have been narrowed with an explicit owner and group. Use 000 as a temporary measure, and let the permanent answer be a real mode with a real owner.
Examples
chmod 000 suspicious.sh
chmod u=,g=,o= suspicious.sh$ ls -l quarantine.bin
---------- 1 alice alice quarantine.bin
$ cat quarantine.bin
cat: quarantine.bin: Permission denied
$ sudo cat quarantine.bin
... contents ... # root ignores the mode
$ chmod 600 quarantine.bin # owner can always restore
$ rm quarantine.bin
rm: remove write-protected regular file? y # directory decidesThings that catch people out
- 000 does not stop deletion. Write permission on the parent directory is what governs removing a file, whatever the file's own mode says.
- root is unaffected. Anything running with privilege, including many backup and monitoring agents, reads the file as if the mode were open.
- A directory at 000 makes the whole subtree unreachable and produces errors that point at the application rather than at the path. Note the change somewhere before you forget it.
- Some editors and tools recreate a file rather than writing into it, which replaces the 000 file with a fresh one at the umask default and quietly undoes the quarantine.
Try it: Chmod Calculator
Tick the nine permission boxes, or type an octal or symbolic value, and get the three digit and four digit octal, the ls -l rendering and the exact chmod command back.
Chmod Calculator
LOCAL · Browser-OnlyCalculate Unix file permissions with an interactive chmod builder
Permission Matrix
| Entity | Read (4) | Write (2) | Execute (1) | Octal | Symbolic |
|---|---|---|---|---|---|
| Owner (u) | 7 | rwx | |||
| Group (g) | 5 | r-x | |||
| Others (o) | 5 | r-x |
Special Bits
Advanced permission flags for executables and directories
Generated Permissions
755rwxr-xr-x-rwxr-xr-xchmod 755 filenamechmod u=rwx,g=rx,o=rx filenamePermission Breakdown
Owner (u)
7rwx- - Read files / list directory contents
- - Write / modify / delete
- - Execute / traverse directory
Group (g)
5r-x- - Read files / list directory contents
- - Execute / traverse directory
Others (o)
5r-x- - Read files / list directory contents
- - Execute / traverse directory
Common Permissions Reference
| Octal | Symbolic | Meaning |
|---|---|---|
777 | rwxrwxrwx | Full access for everyone |
755 | rwxr-xr-x | Owner full, others read and execute |
750 | rwxr-x--- | Owner full, group read and execute |
700 | rwx------ | Owner full access only |
666 | rw-rw-rw- | Read and write for everyone |
644 | rw-r--r-- | Owner read/write, others read only |
600 | rw------- | Owner read/write only |
555 | r-xr-xr-x | Read and execute for everyone |
444 | r--r--r-- | Read only for everyone |
400 | r-------- | Owner read only |
Related File permissions
All file permissions →chmod 070: Group Only Access and the First Match Rule
070 grants the group everything and the owner nothing. The owner really is denied, because the kernel checks one class only, and this mode proves it.
chmod 007: Everyone Else Gets Everything, the Owner Gets Nothing
007 gives every other account full access while locking out the owner and the group. Almost always a typo for 700, and a lesson in how chmod is authorised.
chmod 400: Read Only Keys and Downloaded PEM Files
400 gives the owner read and nothing to anyone else, not even write. The usual mode for a downloaded cloud key pair and how it differs from 600.
chmod 4755: The setuid Bit and What It Actually Does
4755 sets the setuid bit on top of 755, so the program runs as its owner instead of as the caller. Where it is required and why it is dangerous.
chmod 2775: The setgid Bit on Directories and on Files
2775 adds the setgid bit to 775 so new files inherit the directory's group. The fix for shared directories where the team cannot edit each other's files.
chmod 1777: The Sticky Bit and Why /tmp Needs It
1777 adds the sticky bit to a world writable directory so only a file's owner can delete it. The mode of /tmp and the fix for any shared drop directory.
Tools for this
- Chmod Calculator Free online chmod calculator - calculate Unix file permissions with an interactive chmod builder