The shell umask is 027 and an application creates a regular file with requested mode 0666.
Assume no default ACL or other additional factor.
What mode is created?
umask removes requested permission bits; it does not add any. 0666 & ~0027 results in 0640.
Detailed explanation
0666Incorrect. 0666 is the requested base mode before the umask is applied.
Incorrect. 0666 is the requested base mode before the umask is applied.
0650Incorrect. 0650 would remove group read, which 027 does not mask.
Incorrect. 0650 would remove group read, which 027 does not mask.
0627Incorrect. The umask value itself is not the resulting file mode.
Incorrect. The umask value itself is not the resulting file mode.
0640Correct. 0666 with umask 027 produces 0640.
Correct. 0666 with umask 027 produces 0640.
Try it yourself
An example you can run in a temporary verification environment.
umask 027; umaskExpected result
0027Key points
- umask removes permissions
- Regular-file base mode is 0666
- 027 yields 640
Notes
- Environment: Bash 5.2/POSIX umask
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.