1. Here is the situation there are 2 servers: SRV1 (IP: & SRV2 (IP:

    • you can connect to SRV1 from your local computerwith the private-key : test-user-private.pem with the username test.user
    • SRV2 however is only accessible from SRV1 with the private-key: private-user-key.pem for the user private.user
    • There is a file in SRV2 at the location : /data/app/logs/log_archive.tgz

Explain how you would get the above-mentioned file into your local computer Please state it in commands, interspersing them with comments against each command


First copy from SRV2 to SRV1

ssh SRV1 scp SRV2:/data/app/logs/log_archive.tgz /tmp/foo

Then copy to your workstation

scp SRV1:/tmp/foo <workstation>:/tmp/bar

Alternatively, put SRV1 public key in your workstation $HOME/.ssh/authorized_keys and copy from SRV2 to SRV1, then from SRV2 to workstation

ssh SRV1 'scp SRV2:/data/app/logs/log_archive.tgz /tmp/foo; scp /tmp/foo <workstation>:/tmp/bar; rm -f /tmp/foo'

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.