XK0-005 · Question #146
XK0-005 Question #146: Real Exam Question with Answer & Explanation
The correct answer is B: chmod 777 taxes. 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.
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
Explanation
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.
Common mistakes.
- A.
chmod g+x accountingadds execute permission for the group to theaccountingdirectory, changingdrwxrw-r--todrwxrwxr--. While this makes directory traversal more robust and is part of whatchmod 774 accountingdoes, it alone does not grant write permission to the existingtaxesfile. - C.
chgrp taxes accountingis syntactically incorrect;chgrpexpects a group name followed by a file or directory name. - D.
chgrp accounting taxeswould change the group ownership oftaxestoaccounting, but the file is already owned by theaccountinggroup, so this command has no effect on permissions. - F.
chmod u+x accountingadds execute permission for the owner (ann) to theaccountingdirectory, 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)
Reference. https://linuxconfig.org/linux-file-permissions-with-chmod-chown-chgrp-and-umask-commands
Topics
Community Discussion
No community discussion yet for this question.