A Linux technician is resolving permission issues on a web server. A web service running under the `www-data` group requires read and write access to all existing files and subdirectories within `/var/www/html/uploads`. Currently, files inside the directory are owned by `ubuntu:ubuntu` with permissions set to `-rw-r--r--` (`644`), and subdirectories have permissions `drwxr-xr-x` (`755`). The technician must grant group write access to `www-data` across all nested files and subdirectories without altering file user ownership, breaking directory traversal capabilities, or granting world-write permissions. Which of the following command combinations should the technician execute?
- chown -R :www-data /var/www/html/uploads && chmod -R g+w /var/www/html/uploadsCevap
- Bchmod -R www-data /var/www/html/uploads && chown -R 775 /var/www/html/uploads
- Cchown -R www-data: /var/www/html/uploads && chmod -R 664 /var/www/html/uploads
- Dchgrp -u www-data /var/www/html/uploads && chmod -R 777 /var/www/html/uploads
Cevap
The technician should run `chown -R :www-data /var/www/html/uploads && chmod -R g+w /var/www/html/uploads`.
The correct command combination uses `chown -R :www-data` to recursively update group ownership to `www-data` while preserving user ownership (`ubuntu`). It then uses `chmod -R g+w` to recursively append write permissions for the group, turning existing `644` files into `664` and `755` directories into `775`. This grants the web service read and write privileges without removing the directory execute (`x`) bit necessary for file traversal.
Adım Adım Çözüm
Anahtar Kavram
Linux File Ownership and Symbolic/Absolute Permissions Management