nerdexam
CompTIA

XK0-004 · Question #370

A junior administrator issues the following commands on a Linux server: The next day, the junior administrator is unable to edit the file. Which of the following would resolve this issue?

The correct answer is A. Chmod 666 /home/junior_admin/tasklist. chmod 666 sets read and write permissions for the owner, group, and others using octal notation, restoring the file's editability when the owner's write bit was previously removed.

Security

Question

A junior administrator issues the following commands on a Linux server:

The next day, the junior administrator is unable to edit the file. Which of the following would resolve this issue?

Options

  • AChmod 666 /home/junior_admin/tasklist
  • BChmod $+x /home/junior_admin/tasklist
  • CChmod g+s /home/junior_admin/tasklist
  • DChmod o+rwx /home/junior_admin/tasklist

How the community answered

(38 responses)
  • A
    87% (33)
  • B
    8% (3)
  • C
    3% (1)
  • D
    3% (1)

Why each option

chmod 666 sets read and write permissions for the owner, group, and others using octal notation, restoring the file's editability when the owner's write bit was previously removed.

AChmod 666 /home/junior_admin/tasklistCorrect

chmod 666 sets the file mode to rw-rw-rw-, granting read and write permission to the owner, group, and all others. If a prior command removed the owner's write bit (such as chmod 444 or chmod a-w), this command restores write access so the junior administrator can edit the file again. This is the most direct and correct fix for a permission-denied error when an owner attempts to write to a file they own but lack write permission on.

BChmod $+x /home/junior_admin/tasklist

chmod $+x is not valid chmod syntax because $ is interpreted as a shell variable prefix, causing the command to fail or behave unexpectedly - it also targets execute permission rather than write permission.

CChmod g+s /home/junior_admin/tasklist

chmod g+s sets the setgid bit on a file or directory, which affects group inheritance for new files in directories, and does not restore write access for the file owner.

DChmod o+rwx /home/junior_admin/tasklist

chmod o+rwx grants full read, write, and execute permissions to 'others' (users outside the owner and group), but does not restore the owner's own write permission if that bit was removed.

Concept tested: Linux file permissions chmod numeric mode restoration

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

Topics

#chmod#file permissions#octal permissions#access control

Community Discussion

No community discussion yet for this question.

Full XK0-004 Practice