How to Make Files Inherit Parent Folder's Group in Linux?
Short answer
D chmod g+s /Group00DEV/
Question
Key Takeaways
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).
Common mistake: 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.
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
- https://man7.org/linux/man-pages/man1/chmod.1.html
- https://www.gnu.org/software/coreutils/manual/html_node/chmod-invocation.html
These links open the official vendor documentation in a new tab.
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>.
Community Votes
83% of anonymous learners picked answer D. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 3 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 3
-
Qubert2 👍 4 Answered DSet the setgid Bit: 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 The g+s option sets the setgid bit. When this bit is set on a directory, any files or subdirectories created within it will inherit the group of the directory rather than the group of the user who created the file.
-
Kashim 👍 1 Answered DTo ensure that all files and folders created inside the /Group00DEV shared folder inherit the group name of the parent folder, the correct command is: D. chmod g+s /Group00DEV/ Explanation: Set Group ID (SGID) bit (g+s): When the SGID bit is set on a directory, any files or subdirectories created within that directory will inherit the group ownership of the directory rather than the primary group of the user who created the files or subdirectories. This is particularly useful in shared directories where you want all files and directories to remain accessible to a specific group.
-
IFBBPROSALCEDO 👍 1 Answered CC. docker run -it -p 8080:80 --name Web001 nginx Explanation: docker run is used to create and start a new container from an image. -it stands for interactive terminal, which keeps the container running and allows interaction. -p 8080:80 maps port 8080 on the host to port 80 inside the container. --name Web001 assigns the name Web001 to the container. nginx specifies the image to use for the container.
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.