Linux Foundation Certified System Administrator (LFCS) — Question 23
Which of the following commands changes the ownership of file.txt to the user dan and the group staff?
Answer options
- A. chown dan/staff file.txt
- B. chown dan:staff file.txt
- C. chown -u dan -g staff file.txt
- D. chown dan -g staff file.txt
Correct answer: B
Explanation
The correct answer is B because it uses the correct syntax for changing both the user and group ownership by using a colon. Option A is incorrect because it uses a slash instead of a colon, while option C uses flags that are unnecessary for this command, and option D incorrectly places the group option after the filename, which is not the correct syntax.