The question is simple, but the answer is not :

ssh -D 8080 user@host

or

ssh -gCNf -D 8080 user@host

or

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?

link|improve this question

67% accept rate
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
feedback

3 Answers

up vote 3 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.

link|improve this answer
Thanks, I'll try all of them. – behrooz May 6 '11 at 15:32
feedback
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.

link|improve this answer
feedback

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:127.0.0.1:8080 host
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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