Simple Proxy On MacOS

This has improved my life significantly so I want to share it. I think more people could benefit from it.

Your MacOS/Linux has OpenSSH (accessible via ssh command) installed by default. It can act as a proxy between a remote server and your computer. So If you have a remote server (a small VPS for hosting or personal stuff) you can channel your traffic through that server. It’s two simple steps.

Connect with SSH

ssh -D 9090 -N user@yourserver

-D: This will make ssh listen on certain port to proxy the traffic.

-N: Don’t execute remote commands. Meaning, don’t actually put me in the shell of a remote computer. Just for convenience, does not really affect the proxy.

Configure your OS

In Mac, go to System Preferences -> Network.

Select the network you are connected to and click “Advanced”. It’s that “İleri Düzey…” button on my Turkish MacOS.

In this menu, select Proxy tab and check SOCKS proxy. You just got to fill in two information. localhost and the port you have specified (9090) in the ssh command above.

And that’s it. Now all of your traffic is routed through your personal server. You can confirm by checking your IP address.

More Info

You just opened up a SOCKS proxy between your computer and your server. Since OpenSSH implemented this protocol, you can communicate from your client to the server.

I am not really sure but since traffic leaving your computer goes through the SSH tunnel, I think it’s encrypted.

Here is some other articles to learn more:

https://metahackers.pro/ssh-tunnel-as-socks5-proxy/

https://ma.ttias.be/socks-proxy-linux-ssh-bypass-content-filters/

You can read the Turkish version of this blog post from here.