whatis umask

umask

Also known as: user file-creation mask

A per-process mask that removes permission bits from newly created files and directories. A umask of 022 yields 644 files and 755 directories.

What Is umask in Linux?

New files start from a base of 666 and directories from 777, and the umask subtracts bits from those. With the common default 022, group and others lose write permission.

Setting umask 077 makes new files private to their owner, which is sensible for services that write secrets. systemd services set it with UMask= in the unit file.

Example

umask
# 0022
umask 077