chmod 664 — what rw-rw-r-- means
664
rw-rw-r--
The owner and group can read and write; others can read only.
Note: this grants group or shared write access — fine for team directories, but make sure that is what you intend.
Permission breakdown
When to use 664
- Files a team edits together. When several people share a Unix group, 664 lets every group member read and write the same file while outsiders get read-only. This is the core use case: collaborative editing without making the file owner the sole gatekeeper.
- Group-owned project trees. A shared repository, dataset or build artifact directory where the directory is set-group-ID (
chmod g+s) so new files inherit the group. Pair 664 files with 2775 directories so the whole team keeps write access as files are created. - Files written by a service plus edited by humans. A log or state file a daemon (running as the group) appends to, that an admin in the same group also needs to modify. Group write is what makes both writers work without resorting to root.
- Shared upload or drop directories' contents. Where multiple accounts in a group deposit and revise files, but the public should only read — 664 keeps the group collaborative and others passive.
Common mistakes & gotchas
- Group write is only as safe as the group membership. 664 trusts every member of the file's group equally. Audit who is in that group with
getent group— adding a user to the group silently grants them write to every 664 file owned by it. - 664 still lets others read the file. The trailing
4means world-readable. For team-only data that outsiders must not see, drop it to 660 (rw-rw----). 664 is for shared editing of non-secret files. - The group must actually be the right group. 664 is useless if the file's group is the owner's personal login group (which only they belong to). Set the group first with
chgrp devteam file— the permission bits do nothing without correct group ownership. - 664 on a directory is wrong — it needs the x bit. Without execute, the directory can't be entered. Use 775 (
rwxrwxr-x) or 2775 for the directories that hold your 664 files, not 664 itself.
664 vs the alternatives
- 644 (
rw-r--r--) is the single-owner version: only the owner writes, group and others read. Drop from 664 to 644 when collaboration ends and one person should own edits — or to prevent accidental group overwrites. - 660 (
rw-rw----) is 664 with the world locked out — same group read/write, but others get nothing. Choose 660 the instant the shared file holds anything outsiders shouldn't see; choose 664 only when public read is genuinely fine. - 775 (
rwxrwxr-x) is the directory companion to 664 — it adds the execute bit groups need to enter and traverse a shared folder. Use 775 (or 2775 with setgid) on the directories that contain your 664 files.
Set it with chmod
Apply this permission to a single file:
chmod 664 filename
Or apply it recursively to a directory and everything inside it:
chmod -R 664 directory/
The same thing in symbolic form:
chmod u=rw,g=rw,o=r filename
Frequently asked questions
What does chmod 664 mean?
chmod 664 sets permissions to rw-rw-r--: the owner and the group can both read and write; others can read only. It is the standard mode for files a team sharing a group edits together.
When should I use 664 instead of 644?
Use 664 when more than one person (in a shared Unix group) needs to edit the same file. Use 644 when only the owner should write. The extra group-write bit is the whole difference.
Is 664 secure?
It is as secure as the group is trusted — every member of the file's group can modify it, and the file is still world-readable. For team-only data that outsiders must not read, use 660 instead.
Why doesn't group write work even though I set 664?
Usually the file's group is wrong — often the owner's personal login group, which no one else belongs to. Run chgrp to set the shared group first; the 664 bits only help once group ownership is correct.
Other common permissions
Or build any permission with the interactive chmod calculator.