Mayank Sharma
Mayank Sharma

Reputation: 75

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.

Upvotes: 1

Views: 2586

Answers (2)

Martin Prikryl
Martin Prikryl

Reputation: 202474

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 .

Upvotes: 1

Cyrille MODIANO
Cyrille MODIANO

Reputation: 2376

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

Upvotes: 0

Related Questions