Bird
0
0

You have a script that needs to run with root privileges but should be editable only by its owner. Which special permission should you set and how?

hard📝 Application Q9 of 15
Linux CLI - File Permissions and Ownership
You have a script that needs to run with root privileges but should be editable only by its owner. Which special permission should you set and how?
ASetuid bit on the script file
BSetgid bit on the script file
CSticky bit on the script file
DNo special permission, just run with sudo
Step-by-Step Solution
Solution:
  1. Step 1: Determine how to run script with root privileges

    Setuid bit allows the script to run with the file owner's (root) privileges.
  2. Step 2: Confirm editing restrictions

    File ownership and permissions control editing rights; setuid does not affect editing.
  3. Step 3: Evaluate other options

    Setgid affects group, sticky bit affects deletion, sudo requires manual use.
  4. Final Answer:

    Setuid bit on the script file -> Option A
  5. Quick Check:

    Setuid runs script as owner (root) [OK]
Quick Trick: Setuid runs script as root, owner controls edits [OK]
Common Mistakes:
  • Using setgid instead of setuid
  • Confusing sticky bit with execution
  • Ignoring need for setuid to run as root

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes