010-150 · Question #36
Which permissions should be given to a file that needs to be opened and edited by the file's owner and opened read-only by the file's group?
The correct answer is D. 0640. Unix octal permissions assign three digits for owner, group, and others respectively, where read=4, write=2, and execute=1.
Question
Which permissions should be given to a file that needs to be opened and edited by the file's owner and opened read-only by the file's group?
Options
- A0751
- B0466
- C0540
- D0640
- E0444
How the community answered
(38 responses)- A8% (3)
- B5% (2)
- D84% (32)
- E3% (1)
Why each option
Unix octal permissions assign three digits for owner, group, and others respectively, where read=4, write=2, and execute=1.
0751 gives the owner rwx (7), group r-x (5), and others execute-only (1) - this grants the group execute permission and gives others access, neither of which is required.
0466 gives the owner read-only (4) which prevents editing, and incorrectly grants the group and others read and write (6).
0540 gives the owner read and execute (5), but the owner requires write permission (2) to edit the file.
0640 assigns the owner read and write permissions (6 = 4+2), the group read-only permission (4), and no permissions to others (0). This precisely matches the requirement that the owner can open and edit the file while the group can only open it read-only, with no access granted to others.
0444 grants everyone read-only access, so the owner cannot write or edit the file.
Concept tested: Linux octal file permission notation and chmod
Source: https://man7.org/linux/man-pages/man1/chmod.1.html
Topics
Community Discussion
No community discussion yet for this question.