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 Learn more about umask
- umask Explained umask controls the default permissions given to every new file and directory you create. This guide explains how umask subtracts from the maximum possible permissions and how to set it permanently.
- How Linux Permissions Work Linux permissions control who can read, write, and execute every file and directory on the system. This guide explains the permission model from the basics through to special bits, umask, and ACLs.
Related tools
- umask Calculator See what a umask produces for new files and directories, and where to set it persistently.