Granting execute permission (owner only): Which chmod command gives the file owner execute permission on the file 'note' (without changing other existing permissions)?

Difficulty: Easy

Correct Answer: chmod u+x note

Explanation:


Introduction / Context:
Selective permission changes are common when turning a script into an executable. The chmod command supports symbolic modes that add (+), remove (-), or set (=) permissions for user (u), group (g), and others (o) without affecting unrelated bits.



Given Data / Assumptions:

  • Target file: note.
  • Goal: add execute permission for the owner only.
  • Other existing permissions should remain unchanged.


Concept / Approach:

Use symbolic mode with the user class: u+x means “add execute for user.” It leaves group and others untouched. Verification is done via ls -l, which shows permission triplets as rwx.



Step-by-Step Solution:

Run chmod u+x note.Confirm with ls -l note that the owner's execute bit is set.If the file is a script, ensure it has a valid shebang (for example, #!/bin/sh).Optionally adjust group or others with g+x or o+x if needed.Use chmod u-x to remove execute permission later.


Verification / Alternative check:

Execute the file (./note) if it is a script or binary. If permission denied appears, re-check owner and execute bit, and ensure the filesystem is mounted with exec allowed.



Why Other Options Are Wrong:

a: Grants execute to group, not owner.

b: Adds write, not execute, to owner.

d: Grants execute to user, group, and others, broader than requested.

e: Not applicable; option c is correct.



Common Pitfalls:

Accidentally overexposing a file with ugo+x; forgetting executable shebang for scripts; modifying permissions on a non-executable mount.



Final Answer:

chmod u+x note

More Questions from Unix

Discussion & Comments

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