CompTIA Linux+ (XK0-004) — Question 191
A Linux administrator needs every new file created on a directory to maintain the group permissions of the same directory. Which of the following commands would satisfy this requirement?
Answer options
- A. chmod o+s <directory>
- B. chmod u+s <directory>
- C. chmod +s <directory>
- D. chmod g+s <directory>
Correct answer: D
Explanation
The correct answer is D, as using 'chmod g+s <directory>' sets the setgid bit, which ensures that new files created in the directory inherit the group ownership of the directory. Options A and B set the setuid and other permissions, which do not affect group ownership, while option C is not specific enough to indicate the correct behavior needed for group permissions.