exam questions

Exam XK0-005 All Questions

View all questions & answers for the XK0-005 exam

Exam XK0-005 topic 1 question 201 discussion

Actual exam question from CompTIA's XK0-005
Question #: 201
Topic #: 1
[All XK0-005 Questions]

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 following 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 007 /home/user/script.sh
  • D. chmod o+r /home/user/script.sh
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
NastyNutsu
2 months, 2 weeks ago
A. chmod u+x /home/user/script.sh -- adds execute permissions for the user (owner) B. chmod 600 /home/user/script.sh -- sets read/write for the owner, but not execute C. chmod 007 /home/user/script.sh -- sets read/write/execute for others, but not the owner D. chmod o+r /home/user/script.sh -- gave read to others
upvoted 1 times
...
ID77
2 months, 3 weeks ago
Selected Answer: A
By default, new files may not have execute permissions, and to run a script, the user must have permission to execute it. The u stands for the user (file owner), and +x adds execute. permissions.
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

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.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago