LFCS · Question #784
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. To achieve default file permissions of -rw-r-----, which is octal 640, an administrator must set the umask to 027 to mask out write permission for the group and all permissions for others.
Question
Options
- A037
- B640
- C038
- D027
How the community answered
(39 responses)- A3% (1)
- B8% (3)
- C15% (6)
- D74% (29)
Why each option
To achieve default file permissions of -rw-r-----, which is octal 640, an administrator must set the umask to 027 to mask out write permission for the group and all permissions for others.
A umask of 037 would result in file permissions of 630 (rw- -wx ---), which is not the desired -rw-r-----.
640 represents the desired file permissions, not the umask value; the umask specifies permissions to be *removed* from the default.
038 is an invalid octal number because '8' is not a valid octal digit, making it an impossible umask setting.
The default permissions for a new file are typically 666 (rw-rw-rw-). To achieve 640 (rw-r-----), the umask must remove `w` (2) from the group and `rwx` (7) from others. Therefore, 666 - 027 = 640, or more accurately, 666 AND (NOT 027) = 640.
Concept tested: Linux umask and default file permissions
Source: https://man7.org/linux/man-pages/man2/umask.2.html
Topics
Community Discussion
No community discussion yet for this question.