What does chmod 640 mean?
chmod 640 gives owner read/write, group read. The owner edits the file and a group (for example the web server’s group) can read it; others get nothing. A good choice for config files with credentials that a service running as another user must read.
| Who | Digit | Symbolic | Permissions |
|---|---|---|---|
| Owner (user) | 6 | rw- | read, write |
| Group | 4 | r-- | read |
| Others | 0 | --- | no access |
Each digit is the sum of read (4), write (2) and execute (1). In ls -l the file shows as -rw-r-----.
How to use chmod 640
# one file or directory
chmod 640 filename
# the same permissions in symbolic form
chmod u=rw,g=r,o= filename
# a directory and everything inside it
chmod -R 640 directory/
# only regular files
find path/ -type f -exec chmod 640 {} +
Need a different combination? Tick the boxes in the chmod calculator to get the octal and symbolic values instantly.
Preguntas frecuentes
What does chmod 640 do?
What is 640 in symbolic notation?
rw-r-----, or chmod u=rw,g=r,o= as a symbolic chmod command.