LX0-103 · Question #56
Which of the following commands makes /bin/foo executable by everyone but writable only by its owner?
The correct answer is A. chmod u=rwx,go=rx /bin/foo. Making a file executable by everyone but writable only by its owner requires the 755 (rwxr-xr-x) permission set, which the symbolic expression u=rwx,go=rx produces exactly.
Question
Which of the following commands makes /bin/foo executable by everyone but writable only by its owner?
Options
- Achmod u=rwx,go=rx /bin/foo
- Bchmod o+rwx,a+rx /bin/foo
- Cchmod 577 /bin/foo
- Dchmod 775 /bin/foo
How the community answered
(36 responses)- A78% (28)
- B14% (5)
- C6% (2)
- D3% (1)
Why each option
Making a file executable by everyone but writable only by its owner requires the 755 (rwxr-xr-x) permission set, which the symbolic expression u=rwx,go=rx produces exactly.
The clause u=rwx explicitly sets owner permissions to read, write, and execute. The clause go=rx sets both group and others to read and execute only, denying write access to non-owners. Together these produce the 755 (rwxr-xr-x) bit pattern, satisfying both requirements.
The token o+rwx adds write permission to the others class, which directly violates the requirement that only the owner may write to the file.
Octal 577 translates to r-x/rwx/rwx, which denies write permission to the owner while granting it to both group and others - the opposite of the stated requirement.
Octal 775 translates to rwx/rwx/r-x, which grants write permission to the group in addition to the owner, violating the writable-only-by-owner constraint.
Concept tested: chmod symbolic notation for precise permission assignment
Source: https://man7.org/linux/man-pages/man1/chmod.1.html
Topics
Community Discussion
No community discussion yet for this question.