LFCS · Question #720
You want the default permissions for your files to bE.rw-r-. How must you set umask?
The correct answer is A. 037. The umask value determines the default permissions for newly created files by specifying which permission bits are removed from the default mask of 666.
Question
Options
- A037
- B640
- C038
- D027
How the community answered
(34 responses)- A76% (26)
- B12% (4)
- C9% (3)
- D3% (1)
Why each option
The `umask` value determines the default permissions for newly created files by specifying which permission bits are removed from the default mask of 666.
To achieve `rw-r-----` (octal 640) for files, the `umask` must remove no permissions for the owner (0), remove write and execute for the group (3), and remove all permissions (read, write, execute) for others (7). Applying `umask 037` to the default file permissions of `rw-rw-rw-` (666) results in `rw-r-----` (640).
`640` represents the desired file permissions, not the `umask` value used to achieve them.
`038` is an invalid octal `umask` value because '8' is not a valid octal digit.
While `umask 027` would also result in `rw-r-----` (640) for files, it specifies removing only the write permission for the group (2) as opposed to write and execute (3) provided by `037`.
Concept tested: Umask permissions calculation
Source: https://man7.org/linux/man-pages/man1/umask.1.html
Topics
Community Discussion
No community discussion yet for this question.