XK0-004 · Question #494
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 correct answer is A. scp -r /var/log/archive [email protected]:/log/backups. Copying files recursively to a remote server with a specific user account requires scp with the -r flag and the user@host:/path syntax. Only option A satisfies all three requirements.
Question
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?
Options
- Ascp -r /var/log/archive [email protected]:/log/backups
- Bscp -r /var/log/archive backup.example.com:/log/backups
- Cscp /var/log/archive/* [email protected]:/log/backups
- Dscp -r backup.example.com:/log/backups /var/log/archive
How the community answered
(46 responses)- A87% (40)
- B2% (1)
- C2% (1)
- D9% (4)
Why each option
Copying files recursively to a remote server with a specific user account requires scp with the -r flag and the user@host:/path syntax. Only option A satisfies all three requirements.
The scp -r flag enables recursive copying of directories and their subdirectories. Specifying [email protected]:/log/backups correctly identifies the remote user as 'archive' and the destination path as /log/backups/ on the target server. This command copies /var/log/archive and all its contents to the remote server using the correct user account.
This command omits the required 'archive@' username prefix, so scp would attempt to authenticate as the local user rather than the archive account.
Using a glob without -r copies only the immediate files inside the directory and not subdirectories, failing to replicate the full archive tree.
This command reverses the source and destination, copying from the remote server to the local machine rather than the other way around.
Concept tested: scp recursive remote copy with user authentication
Source: https://man.openbsd.org/scp
Topics
Community Discussion
No community discussion yet for this question.