BLACK FRIDAY SALE – Unlock Up to 25% OFF on All Exam Prep! - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

LPI 010-160 Exam - Topic 1 Question 58 Discussion

Posted by Florinda on Nov 19, 2025 at 10:20 PM

The current directory contains the following file:

-rw-r---r--- 1 root exec 24551 Apr 2 12:36 test.sh

The file contains a valid shell script, but executing this file using ./test.sh leads to this error:

bash: ./test.sh: Permission denied

What should be done in order to successfully execute the script?

Suggested Answer: B

The execute bit in Linux is a permission bit that allows the user to run an executable file or enter a directory. For regular files, such as scripts or binaries, the execute bit must be set for the user to run them. For directories, the execute bit allows the user to access the files and subdirectories inside. Therefore, to successfully execute the script test.sh, the execute bit should be set in the file's permissions. This can be done by using the chmod command with the +x option, for example: chmod +x test.sh. The other options are either irrelevant or incorrect. The file's extension does not affect its executability, only its association with a program. The user executing the script does not need to be in the exec group, as long as the user has the execute permission on the file. The SetUID bit is a special permission bit that allows the user to run the file as the file's owner, regardless of the user's identity. This is not necessary for executing the script, and may pose a security risk. The #!./test.sh syntax is invalid, as the #! is used to specify the interpreter for the script, not the script itself.Reference:

Linux Essentials Version 1.6 Objectives1, Topic 1.4: Command Line Basics, Subtopic: Basic Shell Commands

Linux Essentials Version 1.6 Exam Preparation Guide2, Section 1.4: Command Line Basics, Page 16

Execute vs Read bit.How do directory permissions in Linux work?3


Get Premium 010-160 Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
29 comments · newest first
DA
Dalene 8 months ago
E is incorrect. The shebang is fine as is.
VA
Val 8 months ago
D is too complicated for this.
EV
Evette 8 months ago
C could work too, but it's not necessary.
CA
Carmela 8 months ago
Yeah, the execute bit needs to be set.
AH
Ahmed 8 months ago
Adding to the exec group seems unnecessary, C isn't needed.
PA
Paz 9 months ago
Wait, why would you use #!./test.sh? That's just odd.
SA
Salome 9 months ago
Changing the extension won't help, A is wrong.
ED
Edgar 9 months ago
Totally agree, B is the way to go!
BE
Becky 10 months ago
Just need to set the execute bit, that's B!
LA
Layla 10 months ago
E) The script should be run using #!./test. sh instead of ./test.sh.
CO
Cora 10 months ago
Duh, it's obviously the execute bit. How else are you supposed to run a script?
SH
Sharita 10 months ago
B) The execute bit should be set in the file's permissions.
VA
Vanesa 10 months ago
I vaguely recall that the SetUID bit is more for running scripts with elevated privileges, so I don't think that's the right answer here.
DO
Donette 10 months ago
I practiced a question similar to this, and I think adding the user to the exec group might not be necessary if we can just change the permissions.
HO
Holley 11 months ago
I'm not entirely sure, but I feel like changing the file extension isn't going to help with the permission issue.
NA
Nan 11 months ago
I remember something about file permissions, and I think we need to set the execute bit for the script to run it.
LO
Lorriane 11 months ago
The question seems straightforward - the execute bit is missing, so I'll choose option B to fix that.
ER
Eric 11 months ago
I'm leaning towards option B as well. The error message indicates a permissions issue, so setting the execute bit seems like the right approach.
SO
Socorro 11 months ago
Okay, I know the execute bit needs to be set, so I'll go with option B. That should let me run the script successfully.
SA
Santos 11 months ago
I think B is the right choice.
GL
Glory 12 months ago
A doesn't make sense. Changing the extension?
HE
Herminia 12 months ago
Haha, someone forgot to make the script executable. Classic UNIX mistake!
EL
Elza 1 year ago
Hmm, I'm a bit confused. I'm not sure if changing the extension or setting the SetUID bit would work here.
BI
Billy 1 year ago
I think the issue is with the file permissions, so I'll try option B and set the execute bit.
EL
Eliseo 7 months ago
↳ replying to Billy
Let us know if it works, Leanna!
JU
Justine 7 months ago
↳ replying to Billy
I wonder if anyone else has faced this issue.
AL
Alease 7 months ago
↳ replying to Billy
Setting the execute bit should fix it.
MA
Maile 7 months ago
↳ replying to Billy
Yeah, permissions are usually the problem.
LE
Leanna 8 months ago
↳ replying to Billy
I agree, option B sounds right.
0/2000 characters

Save Cancel