chmod 640 — what rw-r----- means

640 rw-r-----

The owner can read and write; the group can read only; others get nothing.

Permission breakdown

When to use 640

Common mistakes & gotchas

640 vs the alternatives

Set it with chmod

Apply this permission to a single file:

chmod 640 filename

Or apply it recursively to a directory and everything inside it:

chmod -R 640 directory/

The same thing in symbolic form:

chmod u=rw,g=r,o= filename

Frequently asked questions

What does chmod 640 mean?

chmod 640 sets permissions to rw-r-----: the owner can read and write, the group can read only, and others have no access at all. It is common for service config and logs that a trusted group must read but the world must not.

When should I use 640 instead of 644?

Use 640 when the file is semi-sensitive — a chosen group may read it but other users must not. Use 644 only when the file is safe for everyone to read. 640 removes all access for 'others.'

Is 640 secure enough for a private key?

No. 640 lets the whole group read the file. A private SSH key or master credential should be 600 (owner-only), so no other account — group member or not — can read it.

Why can the service still not read my 640 config?

Check the group ownership. 640 grants read to the file's group, so that group must be the service's group (e.g. www-data). If it's still your personal login group, run chgrp to fix it.

Other common permissions

Or build any permission with the interactive chmod calculator.