Exam 010-160 Topic 2 Question 29 Discussion
Actual exam question for Lpi's 010-160 exam
Question #: 29
Topic #: 2
Question #: 29
Topic #: 2
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.shleads to this error:
bash: ./test.sh: Permission denied
What should be done in order to successfully execute the script?
-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.shleads to this error:
bash: ./test.sh: Permission denied
What should be done in order to successfully execute the script?
Suggested Answer: B Vote an answer
Explanation
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. References:
* 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
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. References:
* 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
by Kyle at May 29, 2026, 06:37 PM
0
0
0
10
Comments
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Report Comment
Commenting
You can sign-up / login (it's free).