Contents » Troubleshooting » FAQ (Frequently Asked Questions) »

How can I connect to server which can be accessed via another server only?

One possible approach is to setup SSH tunnel and connect thru the tunnel.

For simple cases, you can setup tunnel directly in WinSCP. For more complex cases (non-default SSH settings, multiple hops, etc.) you need to setup tunnel using external tool, such as PuTTY.

Setting up tunnel in WinSCP

See Tunnel tab on Login dialog.

Setting up tunnel using PuTTY

Below, you will find description how to setup a tunnel using PuTTY SSH client and how to connect with WinSCP thru it. In the text, Server B stays for the target server and Server A stays for the server thru which you need to connect. Note that this is for illustration only, such a simple tunnel can be setup directly in WinSCP.

Setting up the tunnel

In PuTTY configure a session for Server A. I.e. particularly fill in Host Name. Then switch to Connection > SSH > Tunnels tab. And add new forwarded port:

  • Source port: Any free local port, typically above 3000. Example: 3111.
  • Destination: Hostname and port of the Server B separated by colon (the same information you would fill on Session dialog of WinSCP if you were connecting directly). The port will typically be SSH port 22. Example: example.com:22.
  • Make sure forwarded port type is Local (default).
  • Click Add.

Now start the session. Port forwarding starts to work only once you authenticate to Server A. Note that you need to keep the session open as long as you use the tunnel.

You can also setup a tunnel from command-line:

putty.exe <Server A> -L 3111:<Server B>:22

For more information see PuTTY documentation on port forwarding.

Connecting through the tunnel

In WinSCP configure a session for Server B. Most setting will be like if you connect to Server B directly (username, password, etc.). The only differences are:

  • Host name: Fill in “localhost”.
  • Port number: Fill in Source port of forwarded port. Example: 3111.

Save the session and login.

 
  faq_tunnel.txt · Last modified: 10 Apr 2007 20:36 by 80.188.218.63 (prikryl)
 

Site Search

This page

Donate

Donate via PayPal

Associations

Webhosting phpBB
Hosted by SourceForge Bookmark Manager
Driven by DokuWiki

Site design by Black Gate

Promotion consulting by TechWeb Media