Which chmod command removes read permission on the file 'note' for both the group and others, without changing any other bits?

Difficulty: Easy

Correct Answer: chmod go-r note

Explanation:


Introduction / Context:
File permissions in Unix/Linux are separated into owner (user), group, and others. Modifying only specific bits for group and others is common when securing documents. Using symbolic modes in chmod expresses exactly which permissions to add or remove without affecting unrelated bits.


Given Data / Assumptions:

  • Target file is named 'note'.
  • Goal: remove read permission for both group and others.
  • Do not alter user (owner) permissions or execute/write bits.


Concept / Approach:

Symbolic mode allows precise operations: g refers to group, o to others, and -r removes the read bit. Combining them yields chmod go-r note. This removes read permission for group and others simultaneously and leaves all other bits unchanged.


Step-by-Step Solution:

Run: chmod go-r noteVerify: ls -l note (check the permission string, e.g., rwx------/rw------- depending on previous state)Confirm that only group/others read bits changed.Adjust further if necessary (e.g., chmod o-w note) for additional hardening.


Verification / Alternative check:

Compare stat note output before and after. Only the group and others read bits should differ. Optionally test access from a non-owner account to validate behavior.


Why Other Options Are Wrong:

  • chmod go+r note: adds read permission; opposite of requirement.
  • chmod go+rw note: adds read and write; opposite effect.
  • chmod go-x note: removes execute, not read.
  • None of the aboved: incorrect because chmod go-r note is correct.


Common Pitfalls:

  • Mistaking symbolic minus (-) for plus (+); plus adds, minus removes.
  • Changing owner (user) permissions unintentionally; go- targets only group and others.


Final Answer:

chmod go-r note.

More Questions from Unix

Discussion & Comments

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