devkult_
tools29converters34

chmod 664

rw-rw-r--Use with care

Owner and group can read and write; others can read.

664 is the shared-file counterpart of 644: the owner and the group can read and write, everyone else can read. It's the default for new files when the umask is 002, which many distributions use for regular users with per-user groups.

Permission by permission

WhoReadWriteExecuteDigitMeans
owner✓✓—6read and write
group✓✓—6read and write
others✓——4read only
  • In ls -l: -rw-rw-r-- for a file, drw-rw-r-- for a directory.
  • Symbolic form: u=rw,g=rw,o=r
  • New files get this mode when the umask is 002.

Use it for

  • Files edited by several members of a group.
  • Content written by a deploy user and updated by a service in the same group.

Avoid it for

  • Files with secrets — everyone can read them. Use 660 or 640.
  • Scripts that need to run: add execute (775).

Commands

chmod 664 path

set this mode on a file or directory

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

the same, written symbolically

find path -type f -exec chmod 664 {} +

apply it to every file in a tree, leaving the directories alone

stat -c '%a %A %n' path

check the current mode on Linux (macOS: stat -f '%Lp %Sp %N' path)

Try variations

664
-rw-rw-r--
WhoreadwriteexecuteDigit
owner6
group6
others4

The owner can read and write; the group can read and write; everyone else can read only.

chmod 664 file
chmod u=rw,g=rw,o=r file

Read the full guide to chmod 664 →

Frequently asked questions

664 vs 644?

Group write. 664 lets group members edit the file; 644 lets only the owner edit.

Related modes