LX0-103 · Question #184
An administrator wants the default permissions for their files to be -rw-r-----. How must the administrator set umask?
The correct answer is D. 027. umask 027 produces default file permissions of 640 (-rw-r-----) by masking group write and all other permissions from the base file creation mask of 666.
Question
An administrator wants the default permissions for their files to be -rw-r-----. How must the administrator set umask?
Options
- A037
- B640
- C038
- D027
How the community answered
(27 responses)- A7% (2)
- C11% (3)
- D81% (22)
Why each option
umask 027 produces default file permissions of 640 (-rw-r-----) by masking group write and all other permissions from the base file creation mask of 666.
umask 037 masks both write and execute from group (3 = 011 binary), which coincidentally still produces 640 for files since 666 has no execute bits, but it is not the standard umask for this goal and would produce overly restrictive directory permissions of 740 instead of 750.
640 is the target octal permission value itself, not a umask - confusing the desired permission with the mask needed to achieve it.
038 contains the digit 8, which is not valid in octal notation, making this an impossible umask value.
umask 027 means: mask nothing from owner (0), mask only write from group (2 = 010 binary, stripping write from rw- leaving r--), and mask all permissions from others (7 = 111 binary). Applying this to the default file creation mask of 666 via bitwise AND with the complement gives 666 AND 750 = 640, which is -rw-r-----.
Concept tested: umask calculation to achieve specific default file permissions
Source: https://man7.org/linux/man-pages/man1/umask.1p.html
Topics
Community Discussion
No community discussion yet for this question.