SSH SOCKS5 proxy

Written by on .

This article is about creating a tunnel to a remote server that will be instructed to act as a proxy server. It only needs ssh on the local machine, and an sshd-service on the remote server, which is usually already installed on Linux. A proxy may be used to access the internet through the remote server's internet connection.

The following command creates a local SOCKS5 proxy to a remote server. This is basically a port to an ssh-tunnel to the remote server, using the SOCKS5 protocol, so that it may use the remote server's internet connection. A local application (such as an internet browser) can make use of this, by configuring the SOCKS5 proxy in the settings of that application. Sometimes a system-wide SOCKS5 proxy is also possible at the network/wifi/ethernet settings.

ssh -D 1337 -q -C -N -p 22

The above command will keep running until interrupted, an error occurred, or it is killed. To stop the command gracefully, use <CTRL+C>.

In order to make use of the created proxy tunnel, manually configure the application or system like so:

localhost (or use:
SOCKS Version:

Additionally, you may choose an option to also proxy DNS (Domain Name System) when using SOCKS v5, which is recommended for improving privacy.