chmod 070: Group Only Access and the First Match Rule
070 is ---rwx---: the owning group gets read, write and execute while the owner and everyone else get nothing. The owner is genuinely denied, because permission checks use the first matching class rather than combining them.
At a glance
- Octal
- 070, written 0070 in four digit form
- Symbolic
- u=,g=rwx,o=
- On a file
- ----rwx---
- On a directory
- d---rwx---
- Owner
- Nothing. The owner class matches first and grants no permission
- Group
- Read, write, execute
- Others
- Nothing
In detail
The rule this mode demonstrates is the one most people get wrong. When a process opens a file, the kernel checks whether the effective user id matches the owner. If it does, the owner bits decide the outcome and the group and other bits are never consulted. Permissions are not combined, and the first matching class is final.
So a 070 file is unreadable by its own owner, even when that owner is a member of the owning group. The group bits say read, write and execute; the owner never reaches them. Running ls shows a file that looks generously permissioned and cat returns permission denied, which is why this mode turns up in interview questions and rarely anywhere else.
What the owner does keep is the right to change the mode. chmod is authorised by ownership rather than by permission bits, so the owner can run chmod 640 and immediately read a file they were locked out of a moment earlier. The lockout is real while it lasts and completely reversible by the person it locks out.
Root ignores all of it. A privileged process reads and writes regardless of the mode, so 070 keeps out unprivileged accounts including the owner and does nothing at all against an administrator or anything running with the capability to override file permission checks.
There is no honest production use for this mode. It is a teaching case, and it is also what a mistyped 700 looks like on a bad day. If you find it in the wild, read it as evidence that something generated a mode programmatically from the wrong digit position, then decide what was actually intended before setting it.
Examples
chmod 070 oddity.txt
chmod u=,g=rwx,o= oddity.txt$ id
uid=1000(alice) gid=1000(alice) groups=1000(alice),1001(devs)
$ ls -l report.txt
----rwx--- 1 alice devs report.txt
$ cat report.txt
cat: report.txt: Permission denied
Alice is in devs, but the owner class matched first.$ id
uid=1001(bob) gid=1002(bob) groups=1002(bob),1001(devs)
$ cat report.txt
... contents ...
Bob is not the owner, so the group bits apply to him.Things that catch people out
- Being in the owning group does not help the owner. The owner class is checked first and its bits are final, which is the exact opposite of the intuition that permissions add up.
- The owner can still run chmod and undo the lockout instantly, so 070 is never a way to restrict the owner in any durable sense.
- A directory at 070 cannot be entered or listed by its owner, which makes anything inside unreachable for that account no matter how open the inner modes are.
- This mode is usually the result of a script building an octal string from the wrong field. Check the code that set it rather than only fixing the file.
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 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 000: No Permissions for Anyone, and What Still Works
000 removes every permission from every class. What still works afterwards: root reads it, the owner can chmod it back, and it can still be deleted.
chmod 750: Owner Writes, Group Reads, Others Shut Out
750 gives the owner everything, the group read and traverse, and everyone else nothing. The right mode for application directories that must stay private.
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