Bird
0
0

You set the setuid bit on a script using chmod u+s script.sh, but it doesn't run with owner permissions. What is the likely problem?

medium📝 Debug Q14 of 15
Linux CLI - File Permissions and Ownership
You set the setuid bit on a script using chmod u+s script.sh, but it doesn't run with owner permissions. What is the likely problem?
AYou need to set the sticky bit instead
BThe file owner must be root for setuid to work
CThe script is a shell script and setuid does not work on scripts
DYou forgot to set execute permission
Step-by-Step Solution
Solution:
  1. Step 1: Understand setuid behavior on scripts

    Most Linux systems ignore setuid on shell scripts for security reasons.
  2. Step 2: Evaluate other options

    Sticky bit is unrelated, owner need not be root, and execute permission is usually set if script runs.
  3. Final Answer:

    The script is a shell script and setuid does not work on scripts -> Option C
  4. Quick Check:

    Setuid ignored on scripts [OK]
Quick Trick: Setuid rarely works on scripts, only on binaries [OK]
Common Mistakes:
  • Assuming setuid works on all files
  • Confusing sticky bit with setuid
  • Not checking execute permission

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes