View and set the default file permission umask on Linux
The forgotten octal that decides how open every new file is — run `umask` to see it, `umask 027` to tighten it for this shell.
Run bare `umask` to print the current mask and `umask 027` so new files are 640 and new directories 750.
01Command
Command
$ umask 02702What it does
The umask is subtracted (bitwise cleared) from the mode requested at creation: with umask 027, files become 640 (rw-r-----) and directories 750 — group-readable but closed to everyone else. It's per-process and inherited, so a one-off `umask 027` affects only that shell; to make it stick, set it in ~/.bashrc, /etc/profile, or PAM's umask setting. Create files under the new mask without touching your shell using `(umask 027; touch secret.txt)`.
03Risk
!Warning: chmod fixes existing files, umask fixes future ones — changing umask does not retroactively alter any file already on disk.
04Undo
Undo
$ umask 02205Sources
- umask(2) — set file mode creation maskEvidence: Explains that umask bits are cleared from requested permissions when files are created, and that the mask is inherited by children.
Last verified: 2026-09-17 · Category: Security & Privacy