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

The Ubuntu box I am looking at is behind a proxy which supports CONNECT to 80/443 ports. I have set up an outside ssh server on port 443 and can connect to it with corkscrew / ssh without any problems


Host *
    ProxyCommand corkscrew corp.proxy.ip 8080 %h %p

command line to start ssd:

ssh -D 1080 -p 443

So as I said it all works just fine. The problem is though that -D parameter, which supposed to open up a SOCKS proxy does not quite work.

When I run proxychains that's what I get:

 user@laptop:$ proxychains git pull
 ProxyChains-3.1 (
 random chain (1):....'t connect to..corp.proxy.ip:8080

So it seem to initiate a connection to proxy again for some reason.

Similar set up works just fine on windows machine (Bitvise Tunneller/Freecap), all tunnelling works fine.

I have tried to that:

  1. started ssh with -D, having proxy in the config
  2. commented proxy while (1) still runs
  3. ran proxychains

This time ssh did not try to connect to the proxy and connection went fine, but editing config every time back and forth is hardly a solution.

So any ideas how to fix properly?


share|improve this question
up vote 4 down vote accepted

Solution is quite simple after all: make ssh connect to proxy ONLY when it needs to establish a tunnel for the first time:


    ProxyCommand corkscrew corp.proxy.ip 8080 %h %p

That works cool.

Thanks for watching, everybody :)

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.