nerdexam
CompTIA

XK0-004 · Question #146

Joe, a member of the accounting group on a Linux system, is unable to write a file called "taxes" in the accounting shared directory. The ownership and permissions on the directory and file are as…

The correct answer is B. chmod 777 taxes E. chmod 774 accounting. Joe cannot write to the taxes file because the accounting group lacks execute permission on the directory (preventing directory traversal) and lacks write permission on the file itself. Both issues must be resolved together.

Security

Question

Joe, a member of the accounting group on a Linux system, is unable to write a file called "taxes" in the accounting shared directory. The ownership and permissions on the directory and file are as follows:

accounting drwxrw-r-- user = ann, group = accounting taxes -rw-r--r-- , user = ann, group = accounting Which of the following commands would allow Joe to write to the file? (Choose two.)

Options

  • Achmod g+x accounting
  • Bchmod 777 taxes
  • Cchgrp taxes accounting
  • Dchgrp accounting taxes
  • Echmod 774 accounting
  • Fchmod u+x accounting

How the community answered

(60 responses)
  • A
    2% (1)
  • B
    68% (41)
  • C
    17% (10)
  • D
    10% (6)
  • F
    3% (2)

Why each option

Joe cannot write to the taxes file because the accounting group lacks execute permission on the directory (preventing directory traversal) and lacks write permission on the file itself. Both issues must be resolved together.

Achmod g+x accounting

chmod g+x accounting adds execute to the group on the accounting directory and produces the same bit result as E (drwxrwxr--), but since E is the designated correct answer for the directory fix and only one such fix is needed, A is redundant within this answer pair.

Bchmod 777 taxesCorrect

chmod 777 taxes sets read/write/execute for owner, group, and others on the taxes file (-rwxrwxrwx), granting Joe write permission on the file as a group member.

Cchgrp taxes accounting

chgrp taxes accounting has its arguments reversed - the correct syntax is 'chgrp group file', so this command attempts to change the group of a file named 'taxes' to a group named 'accounting' with the arguments transposed, producing an error.

Dchgrp accounting taxes

chgrp accounting taxes correctly changes the group owner of taxes to the accounting group, but the file already belongs to the accounting group, so this is a no-op and does not resolve the missing write permission for group members.

Echmod 774 accountingCorrect

chmod 774 accounting sets permissions to rwxrwxr-- on the directory, adding execute for the accounting group - which is required to traverse the directory and access files within it, since the current rw- group permission blocks directory entry.

Fchmod u+x accounting

chmod u+x accounting adds execute only for the file owner (ann/user), not for the group, so Joe as a group member still cannot traverse the accounting directory.

Concept tested: Linux directory and file permission troubleshooting

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

Topics

#chmod#group permissions#directory execute bit#file write access

Community Discussion

No community discussion yet for this question.

Full XK0-004 Practice