Difficulty: Easy
Correct Answer: =
Explanation:
Introduction / Context:
File permissions in UNIX/Linux can be modified using chmod in symbolic or numeric modes. Symbolic mode uses operators to add, remove, or set permissions for user (u), group (g), others (o), or all (a). Understanding these operators is vital for secure configuration and reproducible scripts.
Given Data / Assumptions:
Concept / Approach:
The operator = sets the permissions absolutely, meaning only the listed bits remain for the targeted classes. In contrast, + adds bits and - removes bits relative to the current state. Numeric mode (e.g., 750) is also “absolute,” but in symbolic syntax, = is the exact-set operator.
Step-by-Step Solution:
To set group to read-only exactly: chmod g=r fileTo set user read/write, group read, others none: chmod u=rw,g=r,o= fileCompare with additive: chmod g+r leaves any existing x intact.Verify permissions: ls -l file
Verification / Alternative check:
Use stat or ls -l before and after to confirm that = replaced previous bits instead of toggling incrementally.
Why Other Options Are Wrong:
+ (Option A) adds bits without clearing others.- (Option B) removes bits without affecting the rest.% (Option D) is not a chmod operator.
Common Pitfalls:
Final Answer:
=
Discussion & Comments