Question 276 of 527
Create simple shell scriptshardMultiple ChoiceObjective-mapped

Quick Answer

The correct action is to add execute permission to the script using chmod +x /home/devops/deploy.sh. This resolves the issue because the shell script permission denied execute permission error occurs when a file lacks the executable bit, preventing the kernel from honoring the shebang line (#!/bin/bash) and running the script directly. The current permissions -rw-rw-r-- grant read and write access but no execute, so when the team runs ./deploy.sh, the shell cannot execute it; however, bash deploy.sh works because bash reads the file as input rather than relying on execute permission. On the Red Hat Certified System Administrator EX200 exam, this scenario tests your understanding of Linux file permissions and the distinction between running a script directly versus invoking an interpreter—a common trap is confusing read permission with execute permission. Remember the mnemonic: “To run, you need the x; without it, bash must be your next.”

EX200 Create simple shell scripts Practice Question

This EX200 practice question tests your understanding of create simple shell scripts. The scenario asks you to isolate a root cause — eliminate options that address a different problem before choosing. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

You are a system administrator for a small company. The development team has created a shell script named 'deploy.sh' that automates deployment of a web application. The script is located at /home/devops/deploy.sh. The team reports that when they run the script with './deploy.sh' from the /home/devops directory, it fails with a 'Permission denied' error. However, running 'bash deploy.sh' works fine. Additionally, the script's first line is '#!/bin/bash' and the file permissions are '-rw-rw-r--'. The team wants to be able to run the script directly without typing 'bash'. Which of the following actions should you take to resolve the issue?

Clue words in this question

Noticing these words before you look at the options changes how you read each choice.

  • Clue: "first"

    Why it matters: Order matters here. You are being tested on which action comes before the others — not which action is generally useful.

Question 1hardmultiple choice
Full question →

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

Add the execute permission to the script using 'chmod +x /home/devops/deploy.sh'.

Option C is correct because the 'Permission denied' error when running './deploy.sh' indicates that the script lacks execute permission. The current permissions '-rw-rw-r--' show read/write for owner and group, and read-only for others, but no execute bit. Adding execute permission with 'chmod +x' allows the script to be run directly via its shebang line.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Change the shebang line to '#!/bin/sh' because bash is not the default shell.

    Why it's wrong here

    The shebang is correct; the issue is permissions, not interpreter.

  • Move the script to /usr/local/bin so it can be found in the PATH.

    Why it's wrong here

    The issue is not about PATH; the script is run from its directory.

  • Add the execute permission to the script using 'chmod +x /home/devops/deploy.sh'.

    Why this is correct

    This makes the script directly executable.

    Clue confirmation

    The clue word "first" in the question point toward this answer.

    Related concept

    Read the scenario before looking for a memorised answer.

  • Change the owner of the script to root using 'chown root:root /home/devops/deploy.sh'.

    Why it's wrong here

    Ownership is not the problem; the user can already read and write.

Common exam traps

Common exam trap: answer the scenario, not the keyword

Red Hat often tests the distinction between execute permission and interpreter availability; candidates may mistakenly think the shebang or PATH is the issue when the real problem is the missing execute bit.

Detailed technical explanation

How to think about this question

When a script is executed directly (e.g., './deploy.sh'), the kernel reads the shebang line to determine the interpreter. The file must have execute permission for the user invoking it; otherwise, the kernel returns EACCES. Running 'bash deploy.sh' works because bash reads the script as a text file, bypassing the execute permission check. In real-world scenarios, scripts in shared directories often have group execute permission to allow team members to run them without sudo.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A small business has 20 workstations on the 192.168.1.0/24 network and one public IP from its ISP. The router uses PAT (NAT overload) so all 20 devices share one public address using different source ports. NAT questions test whether you understand the four address terms and which direction each translation applies.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related EX200 practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free EX200 practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this EX200 question test?

Create simple shell scripts — This question tests Create simple shell scripts — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: Add the execute permission to the script using 'chmod +x /home/devops/deploy.sh'. — Option C is correct because the 'Permission denied' error when running './deploy.sh' indicates that the script lacks execute permission. The current permissions '-rw-rw-r--' show read/write for owner and group, and read-only for others, but no execute bit. Adding execute permission with 'chmod +x' allows the script to be run directly via its shebang line.

What should I do if I get this EX200 question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Are there clue words in this question I should notice?

Yes — watch for: "first". Order matters here. You are being tested on which action comes before the others — not which action is generally useful.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jun 30, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This EX200 practice question is part of Courseiva's free Red Hat 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 EX200 exam.