chmod 640
chmod 640 is rw-r-----.
What 640 grants
| Who | Digit | Permissions | Adds up as |
|---|---|---|---|
| Owner | 6 | read, write | 4 + 2 = 6 |
| Group | 4 | read | 4 = 4 |
| Others | 0 | no access | 0 |
When 640 is the right answer
Owner reads and writes, group reads. A common pattern for configuration that a service reads under its own group while an administrator edits it.
The command
chmod 640 filename
chmod -R 640 directory/
Note that nobody has the execute bit here, so this value cannot be used on a directory that anyone needs to enter. On a directory, execute grants traversal rather than the right to run something.
How it is written elsewhere
| Octal | 640 |
| Symbolic | rw-r----- |
As a file in ls -l | -rw-r----- |
As a directory in ls -l | drw-r----- |
| Binary | 110 100 000 |
| World-writable | No |
Frequently asked questions
What does chmod 640 mean?
It sets owner to read, write, group to read, others to no access. In symbolic notation that is rw-r-----.
How do I apply 640?
Run chmod 640 filename. Add -R to apply it to a directory and everything inside, though be careful: a recursive numeric chmod marks every file the same way, which is rarely correct for a mixed tree of files and directories.
Is 640 safe?
It grants no write access outside the owner, so it is a reasonable setting as long as the owner is the account you intend.
What is 640 in symbolic notation?
rw-r-----. Written as ls -l shows it, with a leading file-type character, an ordinary file would appear as -rw-r----- and a directory as drw-r-----.