Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

The question is simple, but the answer is not :

ssh -D 8080 user@host


ssh -gCNf -D 8080 user@host


wathever with -D #

I need a kind of proxy that i can use with http_proxy variable, in an embedded device that doesn't support SOCKS.

What should i do?

share|improve this question
Shouldn't it be ssh -D user@host:8080 ? –  ngen May 6 '11 at 14:51
i've done it with ssh a while back.. vnc through ssh. but you could I suppose use squid(an http proxy) through ssh. can't recall how i did it though at the moment. it's not -D 'cos (as you know -and better than me) -D is SOCKS if I recall. –  barlop May 6 '11 at 15:03
@ngen: No. -D specifies a port to open the tunnel on, not the port to connect to. (Even the connection port is specified as -p port, not :port, for compatibility reasons.) –  grawity May 6 '11 at 15:05
add comment

4 Answers

up vote 6 down vote accepted
  • Establish the tunnel normally, then start a HTTP proxy that supports using a SOCKS upstream, such as Polipo or Privoxy. Point your program to that proxy on localhost.

    Example Polipo configuration:

    proxyAddress = "::1"
    proxyPort = 8118
    socksParentProxy = "localhost:8080"
    socksProxyType = socks5
  • Run your program inside the tsocks wrapper, which proxies all connections transparently.

  • As others suggested, set up a HTTP proxy on your server, then access it over SSH using ssh -L.

share|improve this answer
Thanks, I'll try all of them. –  behrooz May 6 '11 at 15:32
add comment
ssh -L 8080:localhost:12345 user@host

This will open port 8080 on the local machine, and forward all data to port 12345 on localhost, as seen from the remote machine.

share|improve this answer
add comment

Every -D results into a SOCKS server. If your client can not handle SOCKS forget -D.

You must run a HTTP-Proxy on the remote host and forward with -L:

ssh -f -N -n -L8080: host
share|improve this answer
add comment

Run Privoxy at the remote host, then connect via SSH to Privoxy using the -L option:

-L [bind_address:]port:host:hostport
         Specifies that the given port on the local (client) host is to be
         forwarded to the given host and port on the remote side.  This
         works by allocating a socket to listen to port on the local side,
         optionally bound to the specified bind_address.  Whenever a con-
         nection is made to this port, the connection is forwarded over
         the secure channel, and a connection is made to host port
         hostport from the remote machine.

(manpage source)

share|improve this answer
add comment

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.