XK0-004 · Question #458
An end user is trying to execute a file within a different directory The end user executes the following command: Which of the following commands should the Linux administrator use to run the shell sc
The correct answer is C. chmod 0755. chmod 0755 sets the execute bit for owner, group, and others, which is required before a shell script can be run.
Question
An end user is trying to execute a file within a different directory The end user executes the following command:
Which of the following commands should the Linux administrator use to run the shell scnpt within that folder?
Options
- Achmod 0644
- Bchmod g-x myabc.sh
- Cchmod 0755
- Dchmod u-x myabc,sh
How the community answered
(37 responses)- A5% (2)
- B3% (1)
- C89% (33)
- D3% (1)
Why each option
chmod 0755 sets the execute bit for owner, group, and others, which is required before a shell script can be run.
chmod 0644 (rw-r--r--) sets no execute bits for any user category, leaving the script non-executable for everyone including the owner.
chmod g-x removes the execute bit from the group class, which reduces permissions rather than enabling execution for the end user.
The octal mode 0755 translates to rwxr-xr-x - giving the owner full read, write, and execute permissions while granting group and others read and execute. Without an execute bit set, the kernel returns a 'Permission denied' error regardless of the script's content or the user's identity. This is the standard permission set applied to executable shell scripts on Linux systems.
chmod u-x removes the execute bit from the file owner, which would prevent even the owner from running the script.
Concept tested: Linux file execute permission assignment with chmod
Source: https://man7.org/linux/man-pages/man1/chmod.1.html
Topics
Community Discussion
No community discussion yet for this question.