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?
- sudo chown -R appuser:webgroup /var/www/appAnswer
- Bsudo chmod -R appuser:webgroup /var/www/app
- Csudo chown -r webgroup:appuser /var/www/app
- Dsudo chgrp -R appuser:webgroup /var/www/app
Answer
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.
Step-by-Step Solution
Key Concept
Linux file system ownership management using chown
Estimated Time:1m 0s