How to Make Files Inherit Parent Folder's Group in Linux?
A developer wants to ensure that all files and folders created inside a shared folder named /Group00DEV inherit the group name of the parent folder. Which of the following commands will help achieve this goal?
Community Votes
83% of anonymous learners picked answer D. Votes are pick records left by other test-takers — they are not the verified answer.
Community Insight
This question tests your understanding of special permission bits, particularly the setgid bit, and the common trap is confusing it with ordinary read/write permissions like chmod g+w.
The setgid bit on a directory causes all new files and subdirectories to inherit the parent folder's group ownership. The correct command is chmod g+s /Group00DEV/, as confirmed by the community (83% chose D).
The most common wrong answer is C (chmod g+r) or B (chmod g+w), which only modify read/write permissions and do not enforce group inheritance. The setgid bit is the special mechanism required for this behavior.
Community Discussion (3 comments)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
Expert Analysis
Why the Answer Is Correct
The setgid bit (chmod g+s) on a directory ensures that any files or subdirectories created inside it inherit the group of the parent directory, not the primary group of the user who creates them. This is exactly what the developer needs for a shared folder.
As community comment [1] explains, setting the setgid bit with sudo chmod g+s /Group00DEV makes the directory's group ownership apply to new entries. Comment [2] reiterates that the SGID bit is the correct solution for group inheritance.
The symbolic mode g+s adds the setgid permission for the group, which is the standard Linux way to achieve this behavior.
Why the Other Options Are Wrong
Option A (chmod g+x) adds execute permission for the group. This allows group members to traverse or access the directory but does not affect group ownership of new files.
Option B (chmod g+w) adds write permission for the group. This allows group members to create files but does not set inheritance of the group name.
Option C (chmod g+r) adds read permission for the group. This allows group members to list the directory but has no bearing on group inheritance.
Only option D sets the special SGID bit, which is the mechanism specifically designed for group inheritance on directories.
Community Comment Notes
The top-voted comment (4 likes) directly identifies the correct command and explains the effect clearly: "To ensure that new files and directories inherit the group of the parent folder, set the setgid bit on the directory using the chmod command: sudo chmod g+s /Group00DEV." This comment aligns with the correct answer D.
Comment [2] adds further detail about the SGID bit. However, comment [3] appears to reference an unrelated Docker question, likely a mispost, and should be disregarded. The consensus is overwhelmingly D with 83 votes.
Official Reference
Exam Strategy
Memorize the three special permission bits: setuid (u+s), setgid (g+s), and sticky bit (o+t). For any question asking about inheriting group ownership on a shared directory, immediately think of the setgid bit and use chmod g+s <directory>.