sftppscp

Transfer file from remote server behind another server (jumphost) to local machine using pscp


I am trying to transfer file from a remote server behind jumphost server to my local machine using pscp and SFTP. I know how to do it for a remote server but not for jumphost-ed server. Also I need to make it automated (no user interaction needed), how do I do it? Thanks.


Solution

  • You can do it the same way you already execute command over the jump host:
    Execute commands on remote server behind another server (jumphost) using Plink

    Just use pscp, where you are using plink.

    Something like this:

    pscp -pw password2 -proxycmd "plink -ssh user1@jumphost -pw password1 -nc anotherIP:22" user2@example.com:/remote/path/file.txt .