breakitdown

chmod 664 (rw-rw-r--)

Answer

chmod 664 sets rw-rw-r--: the owner and every member of the file's group can read and write it; everyone else can only read it. It is the file mode for collaboration through a shared group.

Try

chmod 664 = rw-rw-r--: owner read and write, group read and write, others read.

Read 4Write 2Execute 1Digit
Owner (user)6
Group6
Others4
Special0
  1. 6
    Owner (user): 6 = 4 read + 2 write
  2. 6
    Group: 6 = 4 read + 2 write
  3. 4
    Others: 4 = 4 read

On a file

  • Owner (user) read it and change it
  • Group read it and change it
  • Others read it

On a directory

  • Owner (user) list the names inside; write without x does nothing useful (names only: without x the files cannot be opened or even stat'ed)
  • Group list the names inside; write without x does nothing useful (names only: without x the files cannot be opened or even stat'ed)
  • Others list the names inside (names only: without x the files cannot be opened or even stat'ed)

chmod 664 filechmod u=rw,g=rw,o=r filels -l → -rw-rw-r--

What to know

The difference from 644 is the middle digit: group members can edit, not just read. That only helps if the file's group is a group your collaborators are in, which is what a setgid directory (2775) arranges for new files.

664 is what new files get under umask 002, which some distributions use for ordinary users who each have a private group of their own.

Where it fits

Gotchas

Related explainers

← chmod calculator