XK0-004 · Question #400
A Linux administrator needs to give user2 full permissions to the /opt/share/test directory. Permission for user1 and group2 must remain the same. The administrator runs the Is-Id /opt/share/test/…
The correct answer is A. Chown user1:user2/opt/share/test. Changing the group owner of a directory to a target user grants that user group-level access without modifying the existing owner or permission bits.
Question
A Linux administrator needs to give user2 full permissions to the /opt/share/test directory. Permission for user1 and group2 must remain the same. The administrator runs the Is-Id /opt/share/test/ command and receives the output below:
Which of the following command is the BEST to perform this task?
Options
- AChown user1:user2/opt/share/test
- BSetfac1-m u:user2;rwx /opt/share/test
- CChmod 757 /opt/share/test
- DChgrp user2 opt/share/test
How the community answered
(35 responses)- A77% (27)
- B6% (2)
- C14% (5)
- D3% (1)
Why each option
Changing the group owner of a directory to a target user grants that user group-level access without modifying the existing owner or permission bits.
chown user1:user2 /opt/share/test sets the file owner to user1 and the group owner to user2, giving user2 whatever permissions are assigned to the group field on the directory. This operation preserves user1's ownership and leaves the rwx permission bits unchanged, so user1's and group2's existing access is unaffected.
The command 'Setfac1-m u:user2;rwx' has two syntax errors - the binary name uses the digit '1' instead of the letter 'l' (setfacl), and the ACL spec uses a semicolon instead of the required colon between 'user2' and 'rwx', so the command would fail entirely.
chmod 757 globally changes the read-write-execute bits for owner, group, and others on the directory, which alters the permissions for user1 and group2 rather than leaving them intact.
chgrp user2 /opt/share/test only changes the group owner and does not preserve user1 as the file owner; additionally, the path is missing the required leading forward slash.
Concept tested: chown command to assign group ownership for targeted access
Source: https://man7.org/linux/man-pages/man1/chown.1.html
Topics
Community Discussion
No community discussion yet for this question.