400
r--------
-r--------
chmod 400 — the r-------- permission
A read-only key file — even the owner cannot edit it.
400 is r--------. The owner gets r, and everyone else is shut out.
Who can do what
Three rows for owner, group and others; three columns for read, write and execute. On a folder that last one means the right to go inside.
| Read | Write | Execute | |
|---|---|---|---|
| Owner4 | ✓ | · | · |
| Group0 | · | · | · |
| Others0 | · | · | · |
On a folder the execute bit means going inside. With read but no execute you can list the names yet open nothing in it.
- Symbolic
- r--------
- ls -l (file)
- -r--------
- ls -l (directory)
- dr--------
- chmod symbolic form
- chmod u=r,g=,o=
- Command
- chmod 400 <file>
- Binary
- 100000000
- Decimal
- 256
- umask (directory)
- 377
- umask (file)
- 266
One digit away
How to read this
- Read is 4, write 2, execute 1; add them for one digit. 7 is 4+2+1, 5 is 4+1.
- The digits are owner, group, others, left to right.
- umask is what gets taken away: from 777 for directories, from 666 for files.
- Special bits (setuid 4000, setgid 2000, sticky 1000) add a fourth digit in front — /tmp is 1777.
Frequently asked questions
Q. What does chmod 400 mean?
It is r--------. ls -l shows a file as -r-------- and a directory as dr--------.
Q. How is 400 written in rwx form?
It is the same as chmod u=r,g=,o=.
Q. What can other people do with 400?
Nothing. Only the owner and the group get in.
Q. Which umask produces 400?
377 for directories. The same 266 gives it for files too.