nerdexam
CompTIA

XK0-005 · 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, a member of the 'accounting' group, cannot write to the 'taxes' file because the file itself lacks group write permissions and the directory needs execute permission for group for certain write operations like creating/overwriting files.

Troubleshooting

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

(29 responses)
  • A
    10% (3)
  • B
    55% (16)
  • C
    7% (2)
  • D
    24% (7)
  • F
    3% (1)

Why each option

Joe, a member of the 'accounting' group, cannot write to the 'taxes' file because the file itself lacks group write permissions and the directory needs execute permission for group for certain write operations like creating/overwriting files.

Achmod g+x accounting

`chmod g+x accounting` adds execute permission for the group to the `accounting` directory, changing `drwxrw-r--` to `drwxrwxr--`. While this makes directory traversal more robust and is part of what `chmod 774 accounting` does, it alone does not grant write permission to the existing `taxes` file.

Bchmod 777 taxesCorrect

The `chmod 777 taxes` command would grant read, write, and execute permissions to the owner, group, and others for the `taxes` file. This directly gives Joe (as an 'other' or member of 'accounting' group) write access to the file.

Cchgrp taxes accounting

`chgrp taxes accounting` is syntactically incorrect; `chgrp` expects a group name followed by a file or directory name.

Dchgrp accounting taxes

`chgrp accounting taxes` would change the group ownership of `taxes` to `accounting`, but the file is already owned by the `accounting` group, so this command has no effect on permissions.

Echmod 774 accountingCorrect

The `chmod 774 accounting` command would change the permissions of the `accounting` directory to `drwxrwxr--`. This grants `rwx` (read, write, execute) permissions to the group, which allows Joe, as a member of the 'accounting' group, to create or delete files within that directory, effectively enabling him to 'write to the file' by overwriting or recreating it.

Fchmod u+x accounting

`chmod u+x accounting` adds execute permission for the *owner* (`ann`) to the `accounting` directory, but Ann already has execute permission, and this command does not affect Joe's ability to write to the file.

Concept tested: Linux file and directory permissions (chmod, chgrp)

Source: https://linuxconfig.org/linux-file-permissions-with-chmod-chown-chgrp-and-umask-commands

Topics

#Linux Permissions#chmod#File System Access#User and Group Management

Community Discussion

No community discussion yet for this question.

Full XK0-005 Practice