Skip to content

chmod 664: a file the owner and its group can both edit

Runs in your browser — nothing you paste leaves this page. How we prove that

chmod calculator playground

Examples
Permission bits
Read
Write
Exec
Owner
Group
Other
Enter a value

The matrix, octal and symbolic fields all stay in sync — edit any one and the others follow.

Results update as you type — press Enter to run now.

fig. 29 — chmod-calculator · utilities 664 · rw-rw-r-- · file
Output
Octal664
Symbolicrw-rw-r--
ls -l-rw-rw-r--
Commandchmod 664 file

`chmod 664 file` sets `rw-rw-r--`: the owner and members of the file's group can edit it, and everyone else can only read it.

What chmod 664 means

In 664 the first digit is the owner, the second the group and the third everyone else: the owner gets read and write, the group gets read and write, and others get read only.

ls -l shows -rw-rw-r--. It is what a new file gets when the umask is 002, a setting common on distributions that give each user a private group of the same name, because then group write only reaches the user themself unless the file belongs to a shared group.

Shared project files

664 is the file half of a collaborative directory. Create a group, add the people or services that need to write, chgrp -R team /srv/project, then use 2775 on directories — the 2 is setgid, so new files inherit the team group — and 664 on files. Without the setgid bit, each new file takes the creator's primary group and the sharing quietly stops working.

A process that writes into such a tree should run with umask 002, or the files it creates will come out as 644 and other members lose write.

When not to use it

The last digit still grants read to every account, so 664 is wrong for secrets. If the group should be the only reader, drop to 660. If the file is a program the group runs, use 775 instead so it gains execute.

And 664 is only as narrow as the group: check membership with getent group <name>. A broad group such as users turns 664 into a file most of the machine can edit.

Related values

Every neighbour of 664 changes one digit. 644 takes group write away, the right mode when only the owner edits. 666 adds write for everyone, which defeats the purpose of having a group. 640 keeps the group but removes the world's read access, and 660 (not covered here) does the same while keeping group write. For a group-run script, use 775, or 755 if only the owner should change it.

FAQ

Questions, answered.

Tap a question to expand the answer.

The group digit. In 644 the group can only read; in 664 the group can also write. Choose 664 when several accounts in one group need to edit the same files.

Your umask is 022, which removes group write. Set umask 002 in the shell or service that creates the files, or set the mode explicitly after creating them.

More free, private DevOps tools.

The chmod Calculator is one tool in OpsCanopy — a growing canopy of browser-based validators, converters and testers that never touch a server.

42 free tools, every one offline-capable — opscanopy.com works with no signup and nothing uploaded.

Related utilities: the UUID / ULID Generator, the Case Converter and the Slugify tool — or browse the full tools directory.

Provided as-is for convenience; always double-check permission changes on production systems. OpsCanopy is free and open.