Skip to main content

Command Palette

Search for a command to run...

Prompt: How can I use SSH to create a proxy that my browser can connect to?

Published
2 min read
A

I’m Aiman, and I see the world through prompts. IBM by day, prompt tinkerer by night. Here I share experiments, failures, wins, and the random magic that happens when curiosity meets AI. Welcome to my lens of ideas {<●>}.

[ Link: https://chatgpt.com/share/6930ecc7-8448-800f-bbbd-cf169465ad90 ]

You can turn SSH into a secure SOCKS proxy that your browser can use. This is commonly done with the -D (dynamic port forwarding) option.

Below is the clean, simple guide.


✅ Method: Create a SOCKS Proxy with SSH

1. Run SSH with dynamic port forwarding

On your local machine (Mac, Linux, or even Windows with Git Bash), run:

ssh -D 8080 -C -N username@your-ssh-server

Meaning:

  • -D 8080 → Opens a SOCKS proxy on local port 8080

  • -C → Enables compression (optional but helps)

  • -N → Don’t execute remote commands (just port forwarding)

  • username@server → Your SSH login

You can use any unused local port (1080, 8080, 5000, etc.).

When this SSH session is active, your machine has a running SOCKS proxy at:

127.0.0.1:8080

✅ 2. Configure your browser to use the proxy

Firefox

Go to:

Settings → Network Settings → Manual Proxy
  • SOCKS Host: 127.0.0.1

  • Port: 8080

  • Select: SOCKS v5

  • (Optional) Check: Proxy DNS when using SOCKS v5

    → ensures DNS requests also go through SSH.


Chrome / Edge

Chrome doesn’t have built-in SOCKS settings. Use OS-level settings:

macOS

System Settings → Network → Wi-Fi/Ethernet → Details → Proxies

  • Select SOCKS Proxy

  • Server: 127.0.0.1

  • Port: 8080

Windows

Settings → Network & Internet → Proxy

  • Enable Use a proxy server

  • Address: 127.0.0.1

  • Port: 8080


🧪 3. Test your SSH proxy

Open a browser and go to:

https://whatismyipaddress.com

You should now see your SSH server’s IP, not your local one.


🛑 Notes / Tips

  • Close the SSH window to stop the proxy.

  • Better security: use SSH keys instead of passwords.

  • For reconnecting automatically, tools like autossh help.


If you want, I can help you:

✅ write an alias

✅ write a shell script to start the proxy

✅ configure for Linux, macOS, Windows

Just tell me your OS!