LFCS · Question #694
Which of the following settings for umask ensures that new files have the default permissions -rw- r----- ?
The correct answer is D. 0027. To ensure new files have default permissions of -rw- r----- (octal 640), the umask value should be set to 0027.
Question
Options
- A0017
- B0640
- C0038
- D0027
How the community answered
(47 responses)- A2% (1)
- B6% (3)
- C11% (5)
- D81% (38)
Why each option
To ensure new files have default permissions of `-rw- r-----` (octal 640), the umask value should be set to `0027`.
A umask of 0017 would result in default file permissions of 666 - 017 = 650 (-rw-r-x---), which includes execute permission for the group.
0640 represents a permission mode itself, not a umask value; if used as a umask, it would drastically alter permissions in an unintended way.
A umask of 0038 is not a valid octal representation for permissions because '8' is not a valid digit in octal numbering.
Default permissions for new files are 666 (rw-rw-rw-). To achieve 640 (rw-r-----), the umask value is subtracted from the default. A umask of 027 subtracts 0 from owner (6-0=6), 2 from group (6-2=4), and 7 from others (6-7=0), resulting in 640.
Concept tested: umask and file permission calculation
Source: https://man7.org/linux/man-pages/man2/umask.2.html
Topics
Community Discussion
No community discussion yet for this question.