chmod 664
The owner and the group can read and write, others can only read. The mode for files that several people in one group edit.
| Read (4) | Write (2) | Execute (1) | Digit | |
|---|---|---|---|---|
| Owner | 6 | |||
| Group | 6 | |||
| Others | 4 |
A program runs with the rights of the file's owner.
A program runs with the file's group. In a directory, new files get the directory's group.
In a directory, users can't delete or rename each other's files.
Owner and group can read and write. Others can read.
chmod 664 filechmod u=rw,g=rw,o=r fileCommon values
What 664 allows
| Who | Digit | On a file | On a directory |
|---|---|---|---|
| Owner | 6 rw- | read and change | see the names, nothing more |
| Group | 6 rw- | read and change | see the names, nothing more |
| Others | 4 r-- | read | see the names, nothing more |
ls -l shows this mode as -rw-rw-r-- on a file and as drw-rw-r-- on a directory.
It is 644 with write permission for the group. The owner and the members of the group can edit the file, everyone else can read it.
Where it belongs
Files that a team maintains together, in a directory with 775. With a umask of 002 new files come out as 664 by themselves, which is how systems that give every user a group of their own are often set up.
What to check first
Who is in the group. 664 on a file whose group is called users or staff may mean that everybody with an account can change it. ls -l shows the group in the fourth column. Find out who belongs to it before you rely on it.
The directory has a say too
Write permission on a file covers its contents. Deleting or renaming it is decided by the directory it is in. Someone who may write to the directory can replace a 644 file by another, and someone who may not can't delete a 664 one.
The chmod calculator explains how the digits are built, and what setuid, setgid and the sticky bit add to them.