Ubuntu – What command should be used to connect via SSH through squid proxy

PROXYputtysquidsshUbuntu

I have set up a Squid HTTP Proxy (in centOS) and intended to use it also for ssh connections.

Managed to configure putty (in a windows client) to use this proxy while connecting by ssh. Confirmed in the "target host" that the ssh connection was coming from Proxy server ip instead of the windows client IP.

Used:

  • targethost: 22 for ssh

  • proxyserv: 3128 for proxy (along with proxy credentials)

I'm now having problems connecting to the "target host" using Ubuntu and the same proxy server.

I have tried the following:

me@mycomp:~$ connect-proxy -H test@proxyserv:3128 targethost 22
Enter proxy authentication password for test@proxyserv: 
SSH-2.0-OpenSSH_6.2p2 Ubuntu-6

It hangs in last line, expecting some input. All attempts resulted in a "Protocol mismatch." error.

Putty successfully connects to the http proxy and sends credentials, showing me ssh login right away.
– How to do (with commands in Ubuntu) the same putty does?
– Is there any other way than connect-proxy command to do this?

Edit: Also tried the following with same result ("Protocol mismatch")

me@mycomp:~$ connect-proxy -H test@proxyserv:3128 targethost 22 ssh -l myshel_login

Thanks in advance

Edit: Solution details (thanks to NickW pointing the right way)

installed corkscrew and added to ssh_config

Host targethost   
    ProxyCommand corkscrew proxyserv 3128 %h %p /etc/ssh/proxypass

created proxypass file

login:password

Restarted ssh and used a simple ssh command

ssh mylogin@targethost

(ssh password was asked as usual)

Best Answer

You may want to add corkscrew to your Ubuntu box, and add this line:

ProxyCommand /usr/local/bin/corkscrew proxy.work.com 80 %h %p

to your .ssh/config file.