XK0-004 · Question #385
A Linux administrator needs to change the permission on a script so that the owner has permission to execute. Which of the following BEST accomplishes this task?
The correct answer is B. Chmod u+x script,sh. The chmod u+x command uses symbolic notation to add execute permission exclusively for the file owner. It is the precise command to grant only the owner execute rights without altering group or other permissions.
Question
A Linux administrator needs to change the permission on a script so that the owner has permission to execute. Which of the following BEST accomplishes this task?
Options
- AChmod ug=script,sh
- BChmod u+x script,sh
- CChmod -x script,sh
- DChmod 0644 script,sh
How the community answered
(19 responses)- B89% (17)
- C5% (1)
- D5% (1)
Why each option
The chmod u+x command uses symbolic notation to add execute permission exclusively for the file owner. It is the precise command to grant only the owner execute rights without altering group or other permissions.
chmod ug=script.sh is invalid syntax because chmod does not accept a filename as a permission value in a symbolic assignment expression.
chmod u+x uses symbolic mode where 'u' targets the owner (user) and '+x' adds execute permission without modifying any existing permissions on the file. This directly satisfies the requirement of granting only the owner the ability to execute the script without changing read, write, or group permissions.
chmod -x script.sh removes execute permission for all users - owner, group, and others - which is the opposite of the required action.
chmod 0644 sets permissions to rw-r--r--, granting the owner read and write access but explicitly no execute permission.
Concept tested: Linux file permission modification with chmod symbolic notation
Source: https://man7.org/linux/man-pages/man1/chmod.1.html
Topics
Community Discussion
No community discussion yet for this question.