1Z0-460 · Question #38
You wantto allow multiple users the write access to files within the same directory, in addition, you want all the new files created in this directory to be of the required group instead of the…
The correct answer is A. Set the setgid bit on the directory. Linux: SETGID on directory SETGID stands for SET Group ID. We can use the command chmod to set the group ID bit for a or with numeric mode: chmod 2775 mydir After the change, the permission of the directory "mydir" becomes "drwxrwsr-x". drwxrwsr-x 3 zen zen 4096 2010-03-18…
Question
You wantto allow multiple users the write access to files within the same directory, in addition, you want all the new files created in this directory to be of the required group instead of the primary ID of the user who creates the file. How do you accomplish this?
Options
- ASet the setgid bit on the directory.
- BChange the group owner of the new files manually.
- CRun a cron job to change the group owner.
- DChangethe primary group ID of every user to the required group.
How the community answered
(41 responses)- A83% (34)
- B10% (4)
- C2% (1)
- D5% (2)
Explanation
Linux: SETGID on directory SETGID stands for SET Group ID. We can use the command chmod to set the group ID bit for a or with numeric mode: chmod 2775 mydir After the change, the permission of the directory "mydir" becomes "drwxrwsr-x". drwxrwsr-x 3 zen zen 4096 2010-03-18 19:57 mydir But what is so special about setting the group ID for a directory? The trick is that when another user creates a file or directory under such a directory "mydir", the new file or directory will have its group set as the group of the owner of "mydir", instead of the group of the user who creates it. For example, if user2 belongs to the groups "user2" (main group) and "zen", and he creates a file "newfile" under the diretory "mydir", "newfile" will be owned by the group of "zen" instead of user2's main group ID "user2".
Topics
Community Discussion
No community discussion yet for this question.