A Linux administrator is setting up a shared folder at `/data/projects`. The requirement states that group ownership of the directory must belong to `devgroup`, and all newly created files inside this directory must automatically inherit `devgroup` as their group owner. Which of the following commands must the administrator execute to fulfill both requirements? (Select TWO.)
- chgrp devgroup /data/projectsAnswer
- chmod g+s /data/projectsAnswer
- Cchmod 1777 /data/projects
- Dchown --inherit devgroup /data/projects
Answer
The administrator must execute `chgrp devgroup /data/projects` to assign group ownership and `chmod g+s /data/projects` to enable SetGID group permission inheritance for newly created files.
To set the group ownership of a directory in Linux, the `chgrp devgroup /data/projects` command is used. To ensure that any newly created files automatically inherit the parent directory's group ownership rather than inheriting the creating user's default primary group, the SetGID bit must be assigned to the directory using `chmod g+s /data/projects`.
Step-by-Step Solution
Key Concept
Linux File Ownership and SetGID Bit Directory Inheritance
Estimated Time:1m 30s