More unique IPs than any network on the planet, in the world's largest residential pool. That's Shifter.More unique IPs than any network, in the world's largest pool. That's Shifter.

See the numbers

How to Use an SSH Tunnel as a SOCKS Proxy

One ssh command turns a server you can log in to into a SOCKS5 proxy. The command, how to check it, browser setup, and how it compares with sshuttle.

Engineering · Updated December 2, 2026 · 4 min read
$ ssh -N -D 1080 user@server127.0.0.1:1080SSHserveryour computerweb
One command turns a server you can log in to into your own SOCKS proxy, on the amber port.
Knowledge
On this page
  1. The command
  2. Check that it works
  3. Use it in a browser
  4. Make it permanent
  5. ssh -D or sshuttle
  6. When it is the wrong tool
  7. Keep it safe

If you can log in to a server with SSH, you already have an SSH proxy. Run ssh -D 1080 user@server and your computer gets a SOCKS5 proxy on port 1080 that leaves from the server’s IP address. It is free, encrypted and takes one minute. The limit is that you get one address, usually in a data center, so for many locations or home IPs you need residential proxies instead.

The command

ssh -N -D 127.0.0.1:1080 user@your-server
  • -D starts the SOCKS proxy on your own computer.
  • 127.0.0.1 makes sure only your computer can use it. Leave it in.
  • -N means “do not open a shell, just keep the tunnel”.

The window stays open while the tunnel runs. Press Ctrl+C to close it. To run it in the background, add -f.

Windows 10 and 11 include the same ssh command in PowerShell. On macOS and Linux it is there by default.

To tunnel SSH traffic through another machine on the way, add a jump host with -J user@gateway.

Check that it works

In a second window:

curl -x socks5h://127.0.0.1:1080 https://api.ipify.org

The address it prints should be your server’s. We ran this with OpenSSH 9.9: a plain request showed our own address, and the same request through the tunnel showed the server’s. A page from cloudflare.com loaded over HTTP/2.

Keep the h in socks5h. It tells curl to let the server look up the website’s name. With plain socks5, your computer does the lookup and your own DNS provider sees which sites you visit.

Use it in a browser

Firefox has its own proxy settings. Choose manual configuration, enter 127.0.0.1 and port 1080 as the SOCKS host, pick SOCKS v5, and tick the option to proxy DNS when using SOCKS v5.

Chrome follows the system settings, but you can start a separate window with its own profile:

google-chrome --user-data-dir=/tmp/tunnel --proxy-server="socks5://127.0.0.1:1080"

On macOS, use the full path to the Chrome app. If you switch often, an extension is easier. Our FoxyProxy guide shows how to set up profiles.

Make it permanent

Add the server to ~/.ssh/config:

Host tunnel
    HostName your-server
    User user
    DynamicForward 127.0.0.1:1080
    ServerAliveInterval 30

Now ssh -N tunnel is enough. ServerAliveInterval sends a small message every 30 seconds, which keeps idle connections from being dropped and lets SSH notice when the link is dead.

ssh -D or sshuttle

ssh -D only covers apps that support SOCKS. sshuttle covers the whole device:

sshuttle -r user@your-server 0/0 --dns
ssh -Dsshuttle
CoversApps you set to use itThe whole device
Root on your computerNoYes
Needs on the serverSSH loginSSH login and Python
DNSWith socks5h or a browser optionWith --dns
WindowsBuilt inExperimental

sshuttle’s documentation asks for Python 3.10 or newer on both sides. We did not run it for this guide; the command above follows its documentation.

When it is the wrong tool

  • You need several countries. One server gives you one location.
  • Sites block hosting addresses. A website can see that the IP belongs to a hosting company, and some treat those differently.
  • You need UDP. The SOCKS proxy made by ssh -D carries TCP only.
  • Many people share it. Everyone’s traffic leaves from one address, and the server’s logs tie it to an account.

Keep it safe

Use SSH keys instead of passwords. Never bind the proxy to 0.0.0.0: that opens it to anyone who can reach your computer, and open proxies get found and abused quickly. Only tunnel through servers you own or have permission to use, because your traffic will appear under the owner’s name. If the proxy stops answering, our guide to 407 proxy errors helps you tell a login problem from a connection problem.

Frequently asked questions

What does ssh -D do?

It opens a SOCKS4 and SOCKS5 proxy on your own computer. Anything sent to it goes through the SSH connection and leaves from the remote server.

Is an SSH tunnel the same as a VPN?

No. The -D option covers only the apps you point at it. A VPN, or a tool like sshuttle, can cover the whole device.

Does an SSH tunnel support UDP?

The SOCKS proxy made by ssh -D is for TCP. Apps that need UDP, such as many games and calls, will not work through it.

What is sshuttle?

It is a tool that sends your device's traffic through an SSH server without configuring each app. It needs root access on your computer and Python on both sides, but no admin rights on the server.

Ready to get started?

Try Shifter's residential proxies, 205M+ IPs, 195+ countries, from $0.10/GB.

Get Started