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?
Click on the arrows to vote for the correct answer
A. B. C. D.D.
https://unix.stackexchange.com/questions/115631/getting-new-files-to-inherit-group-permissions-on-linuxThe correct answer is D. chmod g+s <directory>.
Explanation:
The setgid bit (g+s) on a directory ensures that any new file or directory created in that directory will inherit the group ownership of the parent directory. This is a useful feature in collaborative environments where multiple users need to work on the same files.
Here's what each option does:
A. chmod o+s <directory> - sets the setuid bit for others on the directory, which has no effect on the group ownership of new files created in the directory.
B. chmod u+s <directory> - sets the setuid bit for the owner on the directory, which also has no effect on the group ownership of new files created in the directory.
C. chmod +s <directory> - sets both the setuid and setgid bits on the directory, which would ensure that new files inherit both the user and group ownership of the parent directory. However, this may not be desirable if you want to maintain the existing user ownership of new files.
D. chmod g+s <directory> - sets the setgid bit for the group on the directory, which ensures that any new file or directory created in the directory will inherit the group ownership of the parent directory.
Therefore, option D is the correct answer for the given requirement.