Which of the follow-ing should the user execute in order for the script to run properly?

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
B . chmod 600 /home/user/script . sh
C . chmod /home/user/script . sh
D . chmod 0+r /horne/user/script. sh

Answer: A

Explanation:

To run a script file, the user needs to have execute permission on the file. The command chmod 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.

References:

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

[How to Make a Bash Script Executable]

Latest XK0-005 Dumps Valid Version with 136 Q&As

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments