Update: Forget all the crap masquerading as a tutorial that I just wrote. 😀 Please visit this website (“Secure Linux/Unix access with PuTTY and OpenSSH“) which told me everything I needed to know. From learning how to add Putty directly to Windows PATH (which allows me to run Putty.exe directly from the “Run” command), to setting up my authorized_keys file, to configuring Putty & Windows to automagically log me into my SSH server, this tutorial and article does it all!
Okay, the first time I heard of Secure Shell (SSH) tunneling was probably last year when I re-started my blog. What are SSH tunnels? Well, the most common usage for SSH tunnels is to ensure a secure passage way for your packets of information to reach their destination. In this scenario, you would use an SSH tunnel when connecting over an insecure or monitored WiFi connection. This sounds simple enough except that all the “tutorials” I stumbled upon were written by users who were running Linux or Mac. Without too much preamble, I’ll just write up what I did to get connected. As you may or may not know, my web host is Dreamhost. One of the first things I did was check out their DreamHost Wiki which is rather detailed. The easiest and simplest solution that has worked for me is the password authentication set-up. You can automate your SSH tunnel, but I haven’t figured out how to do that yet even though there are scores of how-tos. So, first things first, I’m using 2 tools:
- Firefox browser with SwitchProxy extension installed
- Putty (installed or portable) or any SSH client: I had to scour the web for a 64 bit version of Putty although the x86 or 32 bit version would have worked on my computer.
Some quick pre-requisites for SSH tunneling that I didn’t know before:
- you have to have a server that supports it. Luckily for me, DreamHost allows me to make the decision to have or not have SSH. For others, you may have to dig into your control panel or contact your web hosting providers to request SSH access.
- you need to have a soft and padded table nearby for the amounts of head-banging that will happen because searching takes a while to find the hidden gems. 🙂
If you are familiar with regular FTP clients like I am, it’s a snap to set up your server’s address with the default port number of 22. In the picture, all I did was create my server address (blahblah.clom) with the port number. Then, I typed in the name of the session “blach” and hit “save” and as you can see, it saved my entry as “blach” under “Saved Sessions”.
Your next task will then be to edit “blach” session. You will do this by clicking on your saved session (in this case, blach) and hit “load”. Then, you click on the SSH entry in the left hand pane which is under “Connection”. This is the screen you should be on:
According to Dreamhost‘s instructions (which I followed), all you need to do here is write the “Source port” number in the allowed section and leave the “Destination” blank. Then, you select “Dynamic” and leave it on “Auto”. I know this is esoteric and really not doing a good job of explaining, but I’m trying to understand this myself.
Anyhow, once you have done this, scroll back up (see the first picture) and click on “Session”. Then, highlight your session (in this case, blach) and hit save to save your changes. This was the easy part. What I didn’t know was that in order to activate the SSH tunnel, you need to first open up the connection by logging into the SSH server you are using. So, you do that by opening up Putty (see the first picture again) and highlighting the session you want to open. Then, you simply click “Open”. It should ask you for a username and password in my case. There are ways to make this automated i.e. via keys, but I haven’t figured out how to get that working. Anyhow, once you are logged in, make sure you change the connection options in your browser of choice and in my case, that’s Firefox. Now, since I only intend on using the SSH tunnel on insecure WiFi networks, I needed an extension that would make it easy for to toggle between Firefox not using the SSH tunnel and using the SSH tunnel and all sites I read recommended SwitchProxy. Configure SwitchProxy as I’ve shown in the picture above and you’re all set to go!
That wasn’t so painful, was it? I kid, but seriously, if you want to know more about this stuff, Google is probably your best, yet worst friend. 🙂 Happy hacking away at your computer!!