WinSCP and PuTTY Notes

Needed a place to record some notes about WinSCP and PuTTY...


Tunneling in WinSCP

Sometimes, especially when behind a corporate firewall, it's useful to know how to set up WinSCP for use via "tunneling."

First, find and reach a Linux box to which you have rights. You'll use that host as the tunnel. Let's assume for this example that ours is gandalf.lordoftherings.net.

To expand the example, let's also assume that we must operate through a proxy. Ours here is an HTTP proxy over port 8080, web-proxy.acme.com.

Once you have that, follow the steps below. Remember that this is for just one site and you must do it within the context of that site. If at any time during these steps you click on Session in the upper-left corner of the left pane and see anything other than the hostname/username pair you're creating a session for (in our example here: pookie.com/pookie), then it won't work.

  1. Create the new account:
    1. Set Host name and Port number.
    2. Set User name and Password.
    3. Click Save and choose to save with password.

    4. Always save with password, accept to save new sites, etc. unless you share your host with others or specifically do not wish the convenience of not having to enter a password when connecting.
  2.  
  3. Click on Advanced options (below, left).
  4.  
  5. Click on Connection -> Proxy
    1. Set up proxy (usually using HTTP), proxy hostname and port number.

    2. Your proxy may require a username and password. If so, fill them in.
    3. Save again with password.
  6.  
  7. Click on Connection -> Tunnel.
    1. Check the box Connect through SSH tunnel.
    2. Set Host name and Port number.
    3. Set User name and Password.

    4. Save with password as before.
  8.  
  9. Execute the copy you wish to effectuate to the remote server by clicking Login and proceeding as usual.

Setting up port-forwarding in PuTTY

This works with putty similarly and this utility has similar proxy and tunneling settings of its own.

Normally, I just use putty to get into my Linux host and do stuff when I'm on a Windows machine and don't have a Linux command line handy. However, it can do much more such as this operation in support of helping Thunderbird get mail from Google.

Having launched putty, we create a session and save it. Let's use the same make-believe host as higher up in the WinSCP example.

This example is a little confusing since it's the before and after: to set up forwarding of port 3128 (arbitrarily chosen), you type "3128" into Source port, click the Dynamic button and then Add. The result is "D3128" in the Forwarded ports list.

Of course, you do have to launch putty and authenticate for this to work. Here, I happen to be logged into (not gandalf.lordoftherings.net, but) another host.

Turning to Thunderbird, I set up my Google mail account over IMAP as must be done.

Then, I go into Tools -> Options -> Advanced -> Network & Disk Space -> Connection -> Settings. There I set up my proxy, just as I would for Firefox browsing. I also set up a SOCKS (v5) proxy for the local host (127.0.0.1) on port 3128.

Magically after this, I'm getting my Google mail into Thunderbird despite running behind a firewall and proxy set-up at work.