Soru

Zorluk: OrtamacOS and Linux Operating System Features and Tools

A Linux administrator needs to modify the ownership of a web application directory `/var/www/app` so that the user `appuser` and the group `webgroup` have ownership over the directory and all of its contents. Which of the following commands should the administrator execute?

  1. sudo chown -R appuser:webgroup /var/www/appCevap
  2. B
    sudo chmod -R appuser:webgroup /var/www/app
  3. C
    sudo chown -r webgroup:appuser /var/www/app
  4. D
    sudo chgrp -R appuser:webgroup /var/www/app

Cevap

Execute `sudo chown -R appuser:webgroup /var/www/app` to recursively assign both user and group ownership.
The `chown` command modifies user and group ownership of files and directories. Adding the uppercase `-R` flag applies changes recursively through all subdirectories and files. The argument syntax `appuser:webgroup` correctly sets `appuser` as the owning user and `webgroup` as the owning group.

Adım Adım Çözüm

1
Identify the primary command for managing file and directory ownership in Linux.
The `chown` (change owner) utility is selected.
Unlike `chmod` (permission bits) or `chgrp` (group only), `chown` allows configuring both user and group ownership in a single operation.
2
Determine the proper flags and argument layout for directory tree traversal and ownership assignment.
Use the uppercase `-R` flag for recursive operation and the syntax format `user:group`.
The uppercase `-R` flag ensures all nested files and subdirectories inherit the new ownership settings, and placing `appuser` before the colon assigns user ownership while `webgroup` after the colon assigns group ownership.

Anahtar Kavram

Linux file system ownership management using chown
Tahmini Süre:1m 0s
Bu soruyu puanla