Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a linux jump box between me and a remote server. I have seen a few posts on how to do this with scp (e.g. here), but I am on a Windows box, so the situation is slightly different. I want to copy a file from my local windows machine, through a server setup as a gateway between the two. I should be able to do a multi-hop through the intermediate server. So something like this:

A -> B -> C

I don't want to copy the file to B, then log into B and copy the file again. I'd like to be able to run pscp on a number of files to copy them over.

share|improve this question

2 Answers 2

I found that the best way to do this is to first establish a tunnel to the intermediate server (server B in the illustration). Then pscp over this link. I'll step through exactly what I did.

1) Create an SSH connection to serverB in PuTTY

enter image description here

2) For this connection create a tunnel that goes from port 2222 (you can pick another if you want) to serverC at port 22

enter image description here

3) Open a command window in Windows. Navigate to where PuTTY/pscp is installed on your machine (if not on the Path already)

4) Enter the following command (substituting your own values for those in {}):

c:\putty> pscp -P 2222 -pw {myPasswordOnRemoteMachine} c:\dev\fileIWantToCopy.txt {myusername}@127.0.0.1:/tmp

5) On the remote machineC, the file should be in the /tmp directory

share|improve this answer
    
An easier alternative on Windows is to just use WinSCP and use the tunnel feature built into that app. –  Scott May 18 '13 at 22:41

The easiest solution I found to this problem, was to not use pscp at all. Just use WinSCP to copy the file over.

  1. Enter your final server address (i.e. server 'C' in the question) in the session page and select SCP. enter image description here

  2. Click on 'Advanced...'. Go to Connection>Tunnel. Enter your jump server info here (i.e. Server 'B'). enter image description here

  3. Now just login with either your keyfile or password and you'll be tunneled in.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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