chmod 733: Blind Drop Directories and What They Miss
733 is rwx-wx-wx: the owner has everything, while the group and others can write and traverse but not read. On a directory that creates a drop box, where anyone can add files but nobody but the owner can see what is there.
At a glance
- Octal
- 733, written 0733 in four digit form
- Symbolic
- u=rwx,g=wx,o=wx
- On a file
- -rwx-wx-wx
- On a directory
- drwx-wx-wx
- Owner
- Read, write, execute
- Group
- Create and traverse, no listing
- Others
- Create and traverse, no listing. Can still delete a file whose name they know
In detail
A drop box directory is one where people submit things and cannot see each other's submissions. 733 produces that: write plus execute gives the right to create entries and to resolve names, while the missing read bit means ls returns permission denied. Assignment hand-in directories and one way upload spools are the usual reason anyone reaches for it.
The gap is deletion. Write permission on a directory covers creating, renaming and removing entries, and it is not limited to entries you own. Someone who guesses or learns a filename can delete or overwrite another person's submission even though they can never list the directory. The mode looks tight and is not.
The fix is the sticky bit, giving 1733. With the sticky bit set, only the file's owner, the directory's owner or root may remove or rename an entry, which turns a fragile drop box into a usable one. This is the same mechanism that makes /tmp safe to share, and it is the reason /tmp is 1777 rather than 777.
Even with the sticky bit, a drop box is not confidential. A submitter can overwrite their own file, and a determined user can probe for names by attempting to create files and observing which attempts fail. If confidentiality of the submission list matters, the right answer is an application that owns the directory outright, not a directory mode.
On a file, 733 is meaningless. Write without read gives an account the ability to destroy the contents without ever seeing them, and the execute bit on a file nobody can read only works for compiled binaries. If you have arrived at 733 on a file, something applied a directory mode to the wrong thing.
Examples
chmod 733 /srv/dropbox
chmod u=rwx,g=wx,o=wx /srv/dropboxdrwx-wx-wx teacher staff /srv/dropbox/
$ ls /srv/dropbox
ls: cannot open directory: Permission denied
$ rm /srv/dropbox/alice-essay.txt
# succeeds, name was guessed
$ chmod 1733 /srv/dropbox
drwx-wx-wt teacher staff /srv/dropbox/
$ rm /srv/dropbox/bob-essay.txt
rm: cannot remove: Operation not permittedThings that catch people out
- 733 without the sticky bit lets anyone delete or overwrite a file whose name they know. Use 1733 for any real drop box.
- A user who writes a file into a 733 directory usually cannot read it back afterwards, because reading requires listing or knowing the exact name plus a permissive file mode. Tools that write then verify will fail.
- Write permission on the directory does not grant write permission on the files inside it. Overwriting a file in place still requires write on that file, which is why the practical attack is delete and replace rather than edit.
- 733 is rare enough that monitoring and audit tools flag it. Expect to explain it, and expect a recursive chmod to have been the real cause if you did not set it deliberately.
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 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.
chmod 777: Everyone Gets Everything
777 gives read, write and execute to the owner, the group and everyone else. What it actually allows, why it is never the real fix, and what to use instead.
chmod 711: Directories You Can Enter but Cannot List
711 gives others execute without read, so they can enter a directory by exact name but cannot list it. Where this is used and what it does not protect.
chmod 766: A Mode That Is Almost Always an Accident
766 gives the owner execute and leaves the file writable by the group and by everyone else. Why it combines two errors and what was probably intended.
chmod 700: Private Directories Such as ~/.ssh
700 gives the owner read, write and execute and everyone else nothing. Why SSH insists on it for ~/.ssh and what breaks when a parent is more open.
chmod 666: World Writable Files and the Few Legitimate Ones
666 lets every account read and write the file with no execute bit anywhere. Why it is wrong for regular files and right for a handful of device nodes.
Tools for this
- Chmod Calculator Free online chmod calculator - calculate Unix file permissions with an interactive chmod builder