nerdexam
CompTIA

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.

System Management

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)
  • B
    89% (17)
  • C
    5% (1)
  • D
    5% (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.

AChmod ug=script,sh

chmod ug=script.sh is invalid syntax because chmod does not accept a filename as a permission value in a symbolic assignment expression.

BChmod u+x script,shCorrect

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.

CChmod -x script,sh

chmod -x script.sh removes execute permission for all users - owner, group, and others - which is the opposite of the required action.

DChmod 0644 script,sh

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

#chmod#file permissions#execute bit#user permissions

Community Discussion

No community discussion yet for this question.

Full XK0-004 Practice