Difficulty: Easy
Correct Answer: chmod ugo=r note
Explanation:
Introduction / Context:
The chmod command adjusts read (r), write (w), and execute (x) permissions for the owner (u), group (g), and others (o). A common requirement is to make a file readable by everyone while disallowing modifications and execution. Understanding symbolic modes helps you express that concisely and safely.
Given Data / Assumptions:
Concept / Approach:
Symbolic mode ugo=r sets the permissions for all three classes to exactly read-only. The equals sign (=) assigns the specified set and clears all other bits. This guarantees there is no lingering execute or write access for any class. Using additive modes (+ or -) can be ambiguous if you do not also remove unwanted bits.
Step-by-Step Solution:
Verification / Alternative check:
Compare with chmod 444 note which is the octal equivalent of read-only for all. Both approaches yield the same result.
Why Other Options Are Wrong:
chmod go+r note: adds read for group/others but does not restrict user or clear execute/write that may exist. chmod a-rw: removes read and write for all, not read-only. chmod u+r,g+r,o-x note: adds some permissions and removes only others’ execute; it does not ensure a universal read-only state.
Common Pitfalls:
Using +r without removing w/x; forgetting that execute is needed for directories to traverse; applying read-only to scripts that still need execute permission to run.
Final Answer:
chmod ugo=r note
Discussion & Comments