CompTIA Linux+ (XK0-004) — Question 299
A Linux administrator needs to copy the log files and all the subdirectories in /var/log/archive to the /log/backups/ directory on a remote server at backup.example.com. The administrator will use the archive user account to access the remote server.
Which of the following commands will do this?
Answer options
- A. scp -r /var/log/archive[email protected]:/log/backups
- B. scp -r /var/log/archive backup.example.com:/log/backups
- C. scp /var/log/archive/*[email protected]:/log/backups
- D. scp -r backup.example.com:/log/backups /var/log/archive
Correct answer: A
Explanation
The command in option A is correct as it properly uses the scp command with the -r flag to recursively copy the contents of /var/log/archive to the specified directory on the remote server, authenticating with the archive user. Option B is incorrect because it does not specify the user account. Option C fails to copy subdirectories since it only targets files in the directory. Option D incorrectly attempts to copy from the remote server to the local directory.