At work we have of course a company's-proxy. I need to ssh to some machines out of the company's network. The proxy though requires authentication.
lets assume we have the following variables:
proxy_user="<username I need to authenticate at the proxy>" proxy_pass="<password I need to authenticate at the proxy>" proxy_serv="<hostname of the proxy>" proxy_port=<port of the proxy> ssh_user="<remote username I need to login on the ssh-machine>" ssh_serv="<remote password I need to login on the ssh-machine>" ssh_port=<ssh-port>
When setting the env-variable http_proxy and https_proxy as follows, tools like wget work fine (on the remote server, there is also an web_server installed):
$ export env http_proxy="http://$proxy_user:$proxy_pass@$proxy_serv:$proxy_port" $ wget $ssh_serv Connecting to <proxy_serv>... connected. Proxy request sent, awaiting response... 200 OK Length: unspecified [text/html] Saving to: ‘index.html’
But with ssh it does not work:
$ ssh $ssh_user@$ssh_server:$ssh_port ssh: Could not resolve hostname <ssh_server>:<ssh_port> Temporary failure in name resolution
After googl-ing a little, I found out, that ssh needs an "ProxyCommand", whereas "nc" is not longer recommended, "ssh -W" shall be used. But I couldn't find an example, where authentification was needed. I tried so far:
ssh -o "ProxyCommand='ssh -W %h:%p $proxy_user:$proxy_pass@$proxy_serv:$proxy_port'" $ssh_user@$ssh_serv:$ssh_port
I guess I'm missing something somewhere, but couldn't find a good hint (neither in the manuals, nor on google).
I hope that some of you guys might help me out. Thanks in advance