Assigning specific permissions with chmod — rwx for owner, rw for group, x for others (file ‘‘note’’) Which chmod command sets: owner = read+write+execute, group = read+write, others = execute only?
-
Achmod 761 note
-
Bchmod 671 note
-
Cchmod 167 note
-
Dchmod 4=rwx, g=rw note
-
ENone of the above
Answer
Correct Answer: chmod 761 note
Explanation
Introduction / Context:Being able to translate a human description of permissions into a chmod command is a daily task. Here we translate “owner rwx, group rw, others x” into octal.
Given Data / Assumptions:
- Owner needs rwx (read, write, execute).
- Group needs rw- (read and write).
- Others need --x (execute only).
- Target file name is
note.
Concept / Approach:
Octal digits encode rwx as r=4, w=2, x=1. Compute each class separately and concatenate the digits.
Step-by-Step Solution:
Owner: rwx = 4+2+1 = 7.Group: rw- = 4+2 = 6.Others: --x = 1.Result: 761, so command ischmod 761 note.Verification / Alternative check:
After running the command, ls -l note should display -rwxrw--x, matching the requirement. This confirms the mapping is correct.
Why Other Options Are Wrong:
- chmod 671 note: gives owner = 6 (no execute), group = 7 (adds execute), others = 1 (correct for others) — mismatches the spec.
- chmod 167 note: scrambles the order; owner becomes 1 (wrong), group 6, others 7 — incorrect mapping.
- chmod 4=rwx, g=rw note: invalid syntax; numeric mode must be three digits (or use symbolic modes like
u=rwx,g=rw,o=x). - None of the above: incorrect because 761 is correct.
Common Pitfalls:
Mixing up the order owner-group-others; forgetting that execute is needed to run files or traverse directories; using invalid mixed numeric/symbolic syntax.
Final Answer:
chmod 761 note