'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 1:[1]
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" [email protected]:/remote/path/file.txt .
Solution 2:[2]
You can use a proxycommand:
scp -oProxyCommand = "ssh -W %h:%p username/password@jumphost" username/password@remotehost:/some/path/on/remote/host some/path/on/local/machine
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 |
