chmod practice (symbolic mode example) For a file named note, which command removes execute permission from the user (owner) and grants read permission to the group and others?

Difficulty: Medium

Correct Answer: chmod u-x, go+r note

Explanation:


Introduction / Context:
Symbolic chmod expressions allow precise, readable permission changes. Administrators frequently need to revoke execute rights from owners while providing read access to collaborators, making a combined symbolic expression convenient and auditable in scripts and documentation.


Given Data / Assumptions:

  • Target file is note.
  • Desired result: user loses x; group gains r; others gain r.
  • Order of symbolic operations can be combined with commas in a single command.


Concept / Approach:
Use classes u (user), g (group), o (others) and operators + (add), - (remove). Multiple clauses separated by commas are applied left-to-right. Here we want to remove x for u and add r for g and o. The syntax can be expressed as one command against the file note.


Step-by-Step Solution:
Remove user execute bit: chmod u-x noteAdd read for group and others: chmod go+r noteCombine: chmod u-x,go+r noteVerify: ls -l note shows expected r bits and no x for user.


Verification / Alternative check:
Numeric equivalent depends on prior bits; to set absolutely, use = with known baseline (e.g., chmod u=rw,g=r,o=r note to force 644). Symbolic modification is safer when you only intend relative changes.


Why Other Options Are Wrong:
Option B adds user execute (u+x), opposite of requirement.Option C removes group execute (g-x) but does not address user execute; also grants read to user and others (uo+r) inexactly.Option D adds execute to group and others (go+x), contrary to the brief.


Common Pitfalls:

  • Mistyping commas or spaces causing the shell to parse separate commands incorrectly.
  • Confusing class letters; u is owner, not user accounts in general.
  • Forgetting to quote filenames containing spaces.


Final Answer:
chmod u-x, go+r note

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion