ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 230 - XK0-005 discussion

Report
Export

A user created the following script file:

# ! /bin/bash

# FILENAME: /home/user/ script . sh

echo 'hello world'

exit 1

However, when the user tried to run the script file using the command 'script . sh, an error returned indicating permission was denied. Which of the follow-ing should the user execute in order for the script to run properly?

A.
chmod u+x /home/user/script . sh
Answers
A.
chmod u+x /home/user/script . sh
B.
chmod 600 /home/user/script . sh
Answers
B.
chmod 600 /home/user/script . sh
C.
chmod /home/user/script . sh
Answers
C.
chmod /home/user/script . sh
D.
chmod 0+r /horne/user/script. sh
Answers
D.
chmod 0+r /horne/user/script. sh
Suggested answer: A

Explanation:

To run a script file, the user needs to have execute permission on the file. The commandchmod u+x /home/user/script.sh(A) will grant execute permission to the owner of the file, which is the user who created it. The other commands will not give execute permission to the user, and therefore will not allow the script to run properly.Reference:

[CompTIA Linux+ Study Guide], Chapter 3: Working with Files, Section: Changing File Permissions

[How to Make a Bash Script Executable]

asked 02/10/2024
Sam Bentley
36 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first