How to Make SSH a SOCKS Proxy

Do you understand what SSH TunneL is? It’s simply a kind of VPN, which can encrypt the network when connecting to the internet. Allows the internet network that is used cannot be intercepted by other devices.

There are several ways to do SSH Tunneling. But did you know that basically an SSH connection can also be used as a proxy? So you can use the proxy only in certain programs, aka not for all.

This method use “Dynamic SSH Port Forwarding“, where you need to connect to SSH first before you can make it a proxy. The steps are very simple, just look at the method below.

Tutorial on Making SSH a SOCKS Proxy

Without further ado, the first thing you need to do is connect to the destination SSH server. Use the command below.

ssh -f -N -D 1080 [email protected]

Please change the username and SSH host according to what you want to use. And the above command will make SOCKS Proxy run on port 1080. And by default, the SSH port used to connect is 22.

So after the device has been successfully connected with SSH. Please enough minimize terminal or command prompt, and after that the proxy address that you can use is as follows.

127.0.0.1:1080

Oh yes, make sure port 1080 is not being used by other programs so that the proxy can run properly. Also make sure the port is open on firewall so that it can be used.

Testing SOCKS Proxy

Now that the proxy is running, it’s time to test it. There are two ways to do this, namely using cURL (via terminal or CMD), or directly set it from the browser you are currently using.

1. Using the cURL Perintah Command

cURL is a feature or command that can be used to retrieve content or website code. This tool has many advantages, including being able to change the device identity, cookiesor even use a proxy when visiting a website.

Here is the cURL command to visit a website using SOCKS Proxy:

curl -x socks5://127.0.0.1:1080 http://www.google.com/

If the website code appears in the terminal/CMD, it means the proxy is working properly. On the other hand, when a message appears errorthat’s a sign that the proxy is not working.

2. Setting Proxy in Browser

Some browsers have the option to set a proxy Manually. But I prefer to use the help of an add-on or extension named ProxyOmega. Please install it first through the webstore of each browser.

Once installed, you can start setting up SOCSKS Proxy as 127.0.0.1:1080 and then try to visit the website to check the IP address.

If the IP address changes, it means the proxy was successfully used. Conversely, if the IP address does not change, it is a sign that the proxy is not running.

One more addition, when setting up the proxy there will be two choices between SOCKS4 and SOCKS5. Please choose which SOCKS5.

Also read: How to Create a SOCKS5 Proxy on an Ubuntu VPS

Conclusion

Overall, you just need to connect to SSH with the above command and then let it run. If on Linux, you will be helped with the command TMUX or SCREEN to make the SSH connection run in the background.

Making a SOCSK Proxy itself is actually easy to do, you know with the help of Dante, so if you think using SSH is too complicated, maybe you can directly install Dante. This method has been shared on Blog Second before, please search in the search field.

Hopefully useful and good luck