mediumMultiple ChoiceObjective-mapped
220-1102 Practice Question: That a script they run daily now fails with…
A user reports that a script they run daily now fails with 'Permission denied' even though they haven't changed any permissions. The script is located in /usr/local/bin/script.sh and has permissions -rwxr-xr-x. The user is in the 'users' group. What is the most likely issue?
⚠ Common exam trap
This question tests the distinction between file permission bits and filesystem mount options, trapping candidates who focus only on chmod or ownership changes when the real issue is a system-wide execution restriction like 'noexec'.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
The /usr/local/bin partition is mounted with the noexec option.
The script has execute permissions for the user (rwxr-xr-x), so the 'Permission denied' error is not due to missing execute bits. The most likely cause is that the /usr/local/bin filesystem is mounted with the 'noexec' option, which prevents execution of any binary or script regardless of its permission bits. This is a common administrative security measure that blocks execution from specific partitions, and it would cause the script to fail with 'Permission denied' even though the file permissions appear correct.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The script's shebang line is incorrect.
Why it's wrong here
An incorrect shebang line, such as `#!/bin/bash` being misspelled or pointing to a non-existent interpreter, typically results in an error like "command not found" or "No such file or directory" when the kernel attempts to locate the specified interpreter. It does not usually manifest as a "Permission denied" error for the script itself, assuming the script has execute permissions and the filesystem allows execution. The "Permission denied" error specifically indicates that the *attempt to execute* was blocked, not that the interpreter couldn't be found.
- ✓
The /usr/local/bin partition is mounted with the noexec option.
Why this is correct
When a filesystem is mounted with the `noexec` option, the operating system kernel explicitly prevents the execution of any binaries or scripts located on that partition, regardless of their individual file permissions. Even if a script has the execute bit set (e.g., `chmod +x script.sh`), attempting to run it from a `noexec`-mounted filesystem will result in a "Permission denied" error. This security feature is designed to prevent the execution of potentially malicious code from certain partitions.
- ✗
The user does not have read permission on the script.
Why it's wrong here
If the user lacked read permission on the script, the shell would be unable to open and interpret its contents. This would typically lead to a "Permission denied" error, but it would be due to the inability to *read* the file's data, not specifically an inability to *execute* it as a program. Given that the script is attempting to be run daily, and assuming standard permissions like `r-x` for others, read access is likely present, making this an unlikely cause for an execution failure.
- ✗
The script has been replaced with a directory.
Why it's wrong here
Attempting to execute a directory instead of a script or executable file will result in a distinct error message, typically "Is a directory" or "Permission denied" followed by "Is a directory" on some systems. This error clearly indicates that the target is a directory, not an executable file. A generic "Permission denied" error without this specific clarification suggests that the file itself is recognized as an executable type, but its execution is being blocked by a different mechanism.
Go deeper
Related to this question
About these practice questions
Courseiva writes every 220-1202 question from scratch — 495 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This 220-1202 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 220-1202 exam.