Soru

Zorluk: OrtamacOS and Linux Operating System Features and Tools

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.)

  1. chgrp devgroup /data/projectsCevap
  2. chmod g+s /data/projectsCevap
  3. C
    chmod 1777 /data/projects
  4. D
    chown --inherit devgroup /data/projects

Cevap

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`.

Adım Adım Çözüm

1
Assign directory group ownership
Group ownership of `/data/projects` changes to `devgroup`
Running `chgrp devgroup /data/projects` directly changes the target group owner.
2
Enable SetGID bit on the directory
The directory permission mode includes `g+s`
Setting SetGID on a Linux directory causes newly created files within it to inherit the directory's group instead of the user's primary group.

Anahtar Kavram

Linux File Ownership and SetGID Bit Directory Inheritance
Tahmini Süre:1m 30s
Bu soruyu puanla