XK0-005 · Question #1580
XK0-005 Question #1580: Real Exam Question with Answer & Explanation
The correct answer is A: chmod u+x /home/user/script.sh. 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, a
Question
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?
Options
- Achmod u+x /home/user/script.sh
- Bchmod 600 /home/user/script.sh
- Cchmod 007 /home/user/script.sh
- Dchmod o+r /home/user/script.sh
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.
Topics
Community Discussion
No community discussion yet for this question.