010-160 Exam QuestionsBrowse all questions from this exam

010-160 Exam - Question 24


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?

Show Answer
Correct Answer: B

The error encountered, 'Permission denied', indicates that the file does not have the execute permission. In Unix-like operating systems, a script needs to have the execute bit set in its permissions in order to be run directly from the command line using ./filename. This can be done using the chmod command, for example, chmod +x test.sh. Changing the file extension, adding the user to a specific group, setting the SetUID bit, or modifying the shebang line would not resolve the 'Permission denied' error in this case.

Discussion

5 comments
Sign in to comment
kievOption: B
Feb 17, 2021

B is the answer. You need to add X to the file permissions.

MIUOption: B
Nov 10, 2020

"The execute bit should be set in the file's permissions. " Is this English grammatically correct?

boblee
Nov 13, 2020

its correct.

jfret
Jan 16, 2023

First lesson in IT. Grammar do not matter lol

Elv_GOption: B
Dec 6, 2021

are the "" supposed to be -(dashes)?

linvidiaOption: B
Oct 27, 2022

We need to add "x" to the file permissions.

VovanichOption: B
Dec 20, 2022

The execute bit should be set in the file's permissions.