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

    • 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

Booth
  • 488
  • 2
  • 4
  • 11
  • Check this question https://superuser.com/questions/276533/scp-files-via-intermediate-host , it almost the same – toshyak Oct 30 '18 at 15:01

1 Answers1

0

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'
Ra_
  • 677
  • 4
  • 9