Super User is a question and answer site for computer enthusiasts and power users. 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 wonder a bit. I use openssh-clients-6.2p2-4.fc19.x86_64 on my Fedora 19. I set the environment variable through the console:

"export http_proxy=http://someproxy.officenetwork"

and in the same console I try to run the ssh client

"ssh user@home -p 443"

to connect to my box via ssh on port 443 (other ports are blocked and out of those free the 443 is the least suspicious :-)

But the ssh does not pick up the proxy from the environment variable (opposite to lynx, curl, yum...).

I know I could use a "corkscrew" or "netcast" to help me get the ssh connection through the office proxy but when using e.g.PuTTY or BitwiseSSH I simply specify the proxy server in the settings and everything works.

Which leads me to the question: does the OpenSSH support connecting through a local proxy natively or is it really necessary to use a workaround (corkscrew, nc...) / another client with native proxy support?

share|improve this question
    
The reason it doesn't work is that you are expecting SSH to look for / honor a setting for an HTTP proxy. save for the fact they they both run over TCP they are very different protocols .. – Doon Aug 1 '13 at 11:21
up vote 0 down vote accepted

You can specify a proxy command to ssh, but it requires an external program such as connect or socat. Depending the one you have, you can use ssh this way :

ssh -o ProxyCommand="socat - PROXY:proxy.net:%h:%p,proxyport=8080" login@target

or

ssh -o ProxyCommand="connect -H proxy.net:8080 %h %p" login@target

replacing proxy.net and 8080 by the correct values for your proxy.

as an example, I usually set a bash alias :

alias sshProxy='ssh -o ProxyCommand="connect -H proxy.net:8080 %h %p"'
share|improve this answer
    
thank you, Levans! I have accepted your answer. Pls is the "alias" command reboot-persistent or do you put it in some init script? – user2433984 Aug 1 '13 at 18:32
    
@user2433984 if you want to make it persistent, just put it in your ~/.bashrc. – Levans Aug 1 '13 at 18:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .