You can do a lot of things with SSH besides working securely remote on machines. I’ve already covered at another article how to tunnel (port forwarding) through SSH. This time we’re looking at a way to use SSH as a proxy.
Error: Your Requested widget " adcontrol_sidebar_widget-4" is not in the widget list.
- [do_widget_area footer-a]
- [do_widget_area footer-b]
- [do_widget_area footer-c]
- [do_widget id="meta-4"]
- [do_widget_area sidebar]
- [do_widget id="recent-posts-2"]
- [do_widget id="twitter-follow-5"]
- [do_widget id="blog_subscription-3"]
- [do_widget id="archives-2"]
- [do_widget id="adcontrol_sidebar_widget-3"]
- [do_widget_area widgets_for_shortcodes]
- [do_widget id="adcontrol_sidebar_widget-4"]
- [do_widget_area wp_inactive_widgets]
- [do_widget id="meta-2"]
- [do_widget id="search-2"]
- [do_widget id="categories-2"]
- [do_widget id="recent-comments-2"]
- [do_widget id="rss-3"]
- [do_widget id="twitter-follow-3"]
- [do_widget id="twitter-timeline-profile-3"]
- [do_widget id="twitter-timeline-list-3"]
SSH: A tool not only to do remote work
SSH (Secure Shell) is mostly used to do maintenance on your Linux machines. However, over the years the capabilities of SSH has been extended from a simple secure “remote maintenance protocol” to a utility which is capable of doing things like X-Forwarding (for forwarding graphical application), port forwarding or providing a SOCKS proxy.
Why do you even want to use an proxy server?
Proxy servers are helpful in a lot of ways. For e.g. if you’re staying some nights in a hotel or you’re in any other public Wireless LAN which blocks a specific website you want to visit a proxy will help you to surpass the filter. Or if you are forced to use techniques like DSLight, were you have to share a single IPv4 address with other users. Or to unblock videos on Netflix which are blocked in your country. You see, the situations where a proxy server is helping you are almost countless.
But why would you want to “setup” an proxy server on your own? The simple answer is, that a lot of the public proxy servers are simply overloaded. They have to handle so much traffic that you sometime barely be able to get 50% of your normal internet speed while using one of these public proxy servers. Besides this, using SSH as a proxy is really easy.
How start a SOCKS proxy server by using SSH
In order to establish a SSH connection to your server which will then be an SOCKS proxy, you have to have the SSH server installed on the server side and the client software on the client side of course.
Using SSH as a proxy on Linux or Mac
For Linux or Mac you can use the SSH client command which is integrated in both systems. The following command would start an SSH connection, where your SOCKS proxy would then be locally reachable on port 19999 (19999 is just an suggestion and can be changed to almost everything starting from 1024 to 49151 (so called “user ports”)) :
user@client:~$ ssh -D 19999 user@server
After the connection has been successfully established, configure your browser to use the proxy server (follow the instructions below).
Using SSH as a proxy on Windows
Windows doesn’t comes with an SSH command integrated. This means we need an additional software in order to get connected and use the SSH server as a proxy. My recommendation here is PuTTY. PuTTY is a lightweight SSH client for Windows, which is the counterpart of the SSH command on Linux / Mac. You can download it here. After the download is finished, start PuTTY and enter the server you want to connect to like this:
Navigate to Connection –> SSH –> Tunnels and enter the port 19999 in the Source port field (19999 is just an suggestion and can be almost everything starting from 1024 to 49151 (so called “user ports”)). After you’ve entered the desired port number, ensure that you’ve selected Dynamic instead of Local:
Click on the button Add in order to tell PuTTY to actually use the given information for the next connection. If you clicked on Add, you should see the port number you have chosen with the letter D in the upper box. If you’ve done this as well, you’re ready to connect to your server. After the connection is successfully established, go on and configure your browser (follow the instructions below).
Configure Firefox / Google Chrome to use the SOCKS proxy
Now that we’ve connected successfully to our server via SSH, we can actually use the SOCKS proxy which has been provided with the actual SSH connection.
Configuring Firefox to use the SOCKS proxy
Click on the upper right options Symbol (represented as three horizontal lines) and click on Preferences. On the upcoming window, select General and scroll down until you see the context Network proxy. Click on Settings and enter your SOCKS proxy details like this:
Ensure that you’ve checked the box Use this proxy server for all protocols. After you’ve clicked on OK you’re ready to go. Use portals like BearsMyIp to check if you’re actually surfing through your SSH SOCKS proxy tunnel.
Configuring Google Chrome (or Chromium) to use the SOCKS proxy
For Googles Chrome browser you have to use the command line in order to set your SOCKS proxy. This includes Windows users as well. To start Googles Chrome using your SSH SOCKS proxy start the browser like this:
The windows command line may look like this:
Of course you can change google-chrome to chromium if you’re an Chromium user instead.
An proxy server does have it’s advantages. However, public proxies are sometimes overloaded and you will recognize that as a significantly slow down of your internet connection when you start using them. As an alternative you can use SSH as a simple and fast way to make yourself an SOCKS proxy. Using SSH as a SOCKS proxy is a lot easier than configuring an Apache with Squid for e.g.. If you have a server and you need a proxy, I highly recommend you to use SSH in order to get a safe, fast and stable proxy server with a single command or a few clicks.