LX0-103 · Question #143
Which of the following commands makes /bin/foo executable by everyone but writable only by its owner?
The correct answer is D. chmod 755/bin/foo. The octal mode 755 sets rwxr-xr-x, giving the owner read, write, and execute permissions while restricting group and others to read and execute only.
Question
Which of the following commands makes /bin/foo executable by everyone but writable only by its owner?
Options
- Achmod 557 /bin/foo
- Bchmod o+rwx.a+rx/bin/foo
- Cchown 557 /bin/foo
- Dchmod 755/bin/foo
How the community answered
(29 responses)- A3% (1)
- B3% (1)
- C7% (2)
- D86% (25)
Why each option
The octal mode 755 sets rwxr-xr-x, giving the owner read, write, and execute permissions while restricting group and others to read and execute only.
chmod 557 sets r-xr-xrwx, which grants others full write and execute permissions, directly violating the requirement that only the owner can write to the file.
The syntax is malformed - there is no space between the mode string and the path, and the mode expression itself mixes symbolic and relative notation incorrectly, making the command invalid.
chown modifies file ownership (user and group), not the read, write, or execute permission bits; it cannot set or change any access permissions.
In octal notation, 755 breaks down as owner=7 (rwx), group=5 (r-x), others=5 (r-x). The owner retains write permission while group and others have only read and execute access, satisfying the requirement of executable by everyone but writable only by the owner. No other choice in the list produces this exact permission set.
Concept tested: Linux chmod octal permission notation
Source: https://man7.org/linux/man-pages/man1/chmod.1.html
Topics
Community Discussion
No community discussion yet for this question.