breakitdown

umask 002

Answer

With umask 002, new files are created 664 (rw-rw-r--) and new directories 775 (rwxrwxr-x). Your group can edit what you create; everyone else can only read it.

What umask 002 gives

New files
664 rw-rw-r--
New directories
775 rwxrwxr-x
umask -S
u=rwx,g=rwx,o=rx

What to know

002 is meant for the user-private-group scheme, where every user has a primary group of their own containing only themselves. Group write is then harmless by default, and becomes useful in shared directories whose setgid bit (2775) hands new files to the team group.

On Debian and Ubuntu, /etc/login.defs sets UMASK 022 together with USERGROUPS_ENAB yes. For non-root users whose primary group is a personal group named after them, that setting copies the owner bits into the group bits, so 022 becomes 002 for their login sessions. Root keeps 022.

Gotchas

Related explainers

← chmod calculator