When to use umask
Use umask to restrict default permissions for newly created files and directories. It affects future creation within the process context; it does not repair permissions on existing files.
Syntax
umask [-S] [MASK]Square brackets mark optional arguments; an ellipsis means repetition. Replace example file names, user names and server addresses with your own values.
Common options and arguments
Usage examples
View current mask
umaskThe current mask is printed in its numeric form.
View symbolic form
umask -SA symbolic display shows the permissions that the mask allows through.
Create a file with a restrictive mask in a subshell
(umask 077; touch ./private-notes.txt)The restrictive mask is confined to a subshell, where a new note file is created without group or other access.
Notes and limitations
- The mask affects newly created files and directories, not the permissions of existing ones.
- Resulting permissions also depend on the requested creation mode and ACLs. A umask is not a chmod permission mode.
Common questions and troubleshooting
Does umask change existing files?
No. Adjust existing modes separately after inspecting their current ownership and access requirements.
Why are new files not executable with a permissive mask?
The application chooses initial requested permissions, commonly without execute bits for regular files. A mask can remove requested bits but does not add new ones.
Further help
Options vary by version and distribution. Check the installed documentation with this command: help umask.