Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to use my server as a "proxy" with ssh. However, setting up tunneling with

ssh -D localhost:8000 user@myserver

does not work.

I tested this on various machines with ssh and putty - It connects just fine, but when I set my browser settings accordingly, I just get an error "Connection has been reset". I tried monitoring the traffic with wireshark, but I didn't even see some tunnel-traffic. I explicitly set AllowTcpForwarding to "yes" but I still can't use the tunnel.

When running ssh in verbose mode, I don't get any errors but

debug1: Connection to port 8000 forwarding to socks port 0 requested.
debug1: channel 3: new [dynamic-tcpip]
debug1: channel 3: free: dynamic-tcpip, nchannels 4

What am I doing wrong?

share|improve this question
I suspect that you config your browser at HTTP Proxy line instead of SOCKS host. – quanta Sep 15 '12 at 13:32
I always made sure to set the SOCKS option, no matter which browser I was using. – s1ck Sep 15 '12 at 13:45
Can you do tcpdump at the server (root/sudo access)? Pick an IP address reveal page, get it's IP address, watch that IP for traffic at the server, and try to visit it from your browser. FYI, the OP's ssh command works for me, from my desktop to my remote server. – Skaperen Sep 15 '12 at 19:26
Hi! I already tried capturing with wireshark and it turns out that data never arrives at the server. When loading pages with the proxy activated, just no packets are sent at all. How could that be? – s1ck Sep 23 '12 at 18:17

The correct command is:

ssh user@server -D 8000

In the case you still can't connect check if another process is using this port. The most easy way to do this is with:

netstat --listen |grep 8000

If that is the case just use another port.

share|improve this answer
this doesn't work either. "Connection Reset", same thing – s1ck Sep 15 '12 at 13:15
will update my answer – Lucas Kauffman Sep 15 '12 at 13:17
I made sure to use unused ports. I tried different ones, still the same. I am also running the ssh client as root, so permissions are not a problem, either. – s1ck Sep 15 '12 at 13:25
you shouldn't be running it as root for other reasons, but I'm really baffled a bit. Do you have any iptables running on your server? – Lucas Kauffman Sep 15 '12 at 13:31
No iptables whatsoever, neither on the server nor client-side – s1ck Sep 15 '12 at 13:45

It's an old thread, but I think it's worth posting possible solution.

I had the same issue with several browsers and it turned out to be configuration issue. If that's the case, the following command should work and show IP address of remote machine:

links -socks-proxy localhost:8000

First comment on the question is correct in that browser might try to use HTTP proxy instead of SOCKS proxy, in which case I see exactly the same output from ssh as in the OP's post. And although I did set SOCKS proxy the problem was that I didn't unset HTTP proxy. Once that was done, everything started working as expected.

share|improve this answer
I had the same problem. No matter what I did, the accepted answer didn't work. Your additional answer solved everything for me. Listen up everyone! Don't forget to UNSET the other proxy settings, as well as the "No Proxy for..." addresses like this: – 0xSheepdog Aug 6 '14 at 2:52

I had the same issue, my fix is to add -g option to the command:

$ ssh -D 12324 localhost:8000 user@myserver -g
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.