chmod 644
chmod 644 is rw-r--r--.
What 644 grants
| Who | Digit | Permissions | Adds up as |
|---|---|---|---|
| Owner | 6 | read, write | 4 + 2 = 6 |
| Group | 4 | read | 4 = 4 |
| Others | 4 | read | 4 = 4 |
When 644 is the right answer
The default for ordinary files: the owner can edit, everyone else can read. Web servers expect static files to be readable, and this is the setting that makes them so without allowing anyone to modify them.
The command
chmod 644 filename
chmod -R 644 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 | 644 |
| Symbolic | rw-r--r-- |
As a file in ls -l | -rw-r--r-- |
As a directory in ls -l | drw-r--r-- |
| Binary | 110 100 100 |
| World-writable | No |
Frequently asked questions
What does chmod 644 mean?
It sets owner to read, write, group to read, others to read. In symbolic notation that is rw-r--r--.
How do I apply 644?
Run chmod 644 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 644 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 644 in symbolic notation?
rw-r--r--. Written as ls -l shows it, with a leading file-type character, an ordinary file would appear as -rw-r--r-- and a directory as drw-r--r--.