How to Secure Your Internet Connection via SSH

Wouldn’t it be great if all the Internet connection in the World are secure and encrypted and you don’t have to worry about hackers sniffing your data in the network? Apparently, that does not exist in the real world. Most of the time, when you are using a public network, you are exposing yourself to thousands of hackers who are waiting for you to hand over your confidential data to them.

Luckily, there are several ways to encrypt your Internet connection on a public network, and one of my favorite is SSH tunneling. This may sound too technical a term for most of the casual users, but I can assure you that it is very easy to implement it.

What is SSH?

In short, SSH is a method (or technically, a protocol) that connects two computer in a secure encrypted manner. When two computers are connected via SSH, any data transfer between the two terminal are encrypted.  SSH Tunneling is simply a method where we use the connected  computer as a proxy to browse the web. When we browse the web (with our browser) via SSH tunneling, the proxy server will retrieve the web content and send it back to our computer via secure connection. Two major benefits of using SSH tunneling include:

  1. Masking of your IP address
  2. Secure connection to prevent hackers from sniffing out your data

SSH is mainly used in Linux and Mac, but Windows users can also use SSH with Cygwin.

Getting started

Before we start, there are a few things that you need to have:

  • a SSH server.
  • a SSH client. For Windows users, download Cygwin here.
  • Login name and password to login to the remote computer

Note: If you own a website that is running on a third party web host, you already have a SSH server ready to use. You might need to your web host for permission to access via SSH.

On your Mac or Linux machine, open a terminal. Windows users open up the Cygwin application.

Type in the following command:

ssh -D 9999 login@domain.com

The default connection port for the SSH server is port 22, but this might vary across different SSH server. In this case, you will need to find the port number from your web host and enter in the command:

ssh -D 9999 -p PORT login@domain.com

where PORT is the port number to connect to.

The login is the name you are going to login while the domain can be an IP address or a domain name.

You will be prompted to enter your password.

Configuring your browser

In your browser, go to the options page and look out for the section to change your Proxy settings.

Check the button “Manual Proxy Configuration“. In the SOCKS field, enter “localhost” and 9999 for the port field.

ssh-proxy-configuration

Save and close the option page.

That’s it! Your connection are now secured.

Disconnect your SSH session

To disconnect from the SSH session, first, change the browser setting back to “Direct Internet Connection” (or whatever the previous setting).

Next, in your terminal, type

exit

This will disconnect your SSH session.

Have you tried SSH before? Share your experience in the comments.

Image credit: Dave Halley