Using WinSCP to grab a file through a tunnel

12,906

If you need to connect through a tunnel for an SSH terminal session, you need to connect through the tunnel with WinSCP for an SFTP session too, as the SFTP uses the SSH underneath. There's no difference.

To setup a connection through a tunnel in WinSCP:

  • first set up a session as if you were connecting directly, i.e. py-01
  • click the Advanced button to open the Advanced Site Settings dialog
  • there go to the Connection > Tunnel page
  • check Connect through SSH tunnel
  • in the Host name specify a host to tunnel through, i.e. university.edu
  • in the User name specify an account for the tunnel host

Note that tunnel port is autoselected, so you do not specify it (2200) anywhere.

For detais, see:
https://winscp.net/eng/docs/ui_login_tunnel


If you have an SSH tunnel setup already (using the first command from your question, if it is run on Windows using Cygwin), you can connect to the existing external tunnel with WinSCP:

  • the Host name localhost
  • the Port number 2200

You can also do it the other way around: Explicitly specify the Local tunnel port number in WinSCP, and reuse the WinSCP tunnel also for an SSH terminal client.

Share:
12,906
OneManRiot
Author by

OneManRiot

Updated on July 17, 2022

Comments

  • OneManRiot
    OneManRiot almost 2 years

    There's a file on a node I'm trying to grab with WinSCP. Normally to access the file through my Linux VM I use the commands

    ssh -p 2200 -L 2020:py-01:22 [email protected]
    

    and that builds a tunnel to where I want to go. Then I open a second terminal and say:

    ssh -p 2020 foo@localhost
    

    Which connects me to that tunnel and I can see the file I want to get at. So I'm trying to use WinSCP to do the similar process so I can see the file and then make my own copy of it but I'm falling short. Can someone help me plugin the above commands to WinSCP?