A user creates a regular file in a setgid directory owned by group devops.
Ignore ACLs and other additional factors.
What is the file's basic owning group?
A new file in a setgid directory inherits the parent directory's group ID, keeping files in a shared workspace aligned.
Detailed explanation
Incorrect. A setgid directory does not force new files to be owned by root.
Incorrect. A setgid directory does not force new files to be owned by root.
Correct. The new file inherits the parent directory's devops group.
Correct. The new file inherits the parent directory's devops group.
Incorrect. A file's executable owner is unrelated to its group inheritance.
Incorrect. A file's executable owner is unrelated to its group inheritance.
Incorrect. Without setgid, the primary group may be used; here the parent group is inherited.
Incorrect. Without setgid, the primary group may be used; here the parent group is inherited.
Try it yourself
An example you can run in a temporary verification environment.
man 7 inodeExpected result
set-group-IDディレクトリにおける新規ファイルのgroup ID継承Key points
- The parent GID is inherited
- Shared group ownership is maintained
- New subdirectories can inherit setgid
Notes
- Environment: Linux man-pages 6.x
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.