nerdexam
CompTIA

XK0-004 · Question #518

A Linux administrator is troubleshooting an issue with a shell script. Users in the accounting department are unable to run the script, but users in the sales department are not having issues. Users i

The correct answer is D. chmod a+x script.sh. The script's 'other' permission bits are set to r-- (read only), so accounting department users who are not members of the 'sales' group cannot execute it; adding the execute bit for all resolves this.

Security

Question

A Linux administrator is troubleshooting an issue with a shell script. Users in the accounting department are unable to run the script, but users in the sales department are not having issues. Users in both departments should be able to run the script. The administrator checks the permissions on the script and receives the following information:

-r-xr-xr-- joe sales script.sh Which of the following commands should the administrator execute to resolve the problem?

Options

  • Achgrp accounting script.sh
  • Bchmod 644 script.sh
  • Cchown accounting script.sh
  • Dchmod a+x script.sh

How the community answered

(30 responses)
  • A
    3% (1)
  • B
    17% (5)
  • C
    7% (2)
  • D
    73% (22)

Why each option

The script's 'other' permission bits are set to r-- (read only), so accounting department users who are not members of the 'sales' group cannot execute it; adding the execute bit for all resolves this.

Achgrp accounting script.sh

chgrp accounting script.sh changes the group owner to 'accounting', which would give accounting users the group execute bit but would revoke execute access from sales department users who are no longer the group.

Bchmod 644 script.sh

chmod 644 sets permissions to rw-r--r--, which removes the execute bit from all categories and prevents anyone from running the script.

Cchown accounting script.sh

chown accounting script.sh changes the file's owner to the 'accounting' user/group, which does not add execute permission for the 'other' category where accounting department members currently reside.

Dchmod a+x script.shCorrect

The permission string '-r-xr-xr--' shows the owner (joe) and group (sales) both have execute permission, but the 'other' category has only read permission (r--). Accounting users fall into 'other' because they are neither 'joe' nor members of 'sales'. Running 'chmod a+x script.sh' adds the execute bit for owner, group, and other simultaneously, granting accounting users the ability to run the script without altering ownership or breaking existing access.

Concept tested: Linux file permission bits and chmod for script execution

Source: https://man7.org/linux/man-pages/man1/chmod.1.html

Topics

#chmod#execute permissions#group permissions#file access control

Community Discussion

No community discussion yet for this question.

Full XK0-004 Practice