Using SSH over a Proxy

Written by BinnyVA on April 9, 2007 – 1:42 am -


Back in the days when I was working in a web development company, I had to ssh into some sites for setting up crons, importing database dumps etc. But there was a problem – my system was behind a proxy. And SSH did not have an option to connect through a proxy.

To use ssh over a proxy connection, you need a software called Cocrkscrew. Download the source and compile/install it.


tar -xzf corkscrew-2.0.tar.gz
cd corkscrew-2.0
[Enter Password]
make install


Open the file ~/.ssh/config

Add this line..

ProxyCommand /usr/local/bin/corkscrew <proxy_server_ip> <proxy_server_port> %h %p


ProxyCommand /usr/local/bin/corkscrew 80 %h %p

Here is the proxy server and 80 is the port.

After this is done, just connect to the remote server using ssh.

ssh | Digg it | reddit | StumbleUpon

Posted in Networking, Tools | 11 Comments »

11 Comments to “Using SSH over a Proxy”

  1. […] was a post on LinDesk about how to use SSH over proxy. Thats surely a big issue for people living in developing country. They have to work behind proxy. […]

  2. Clemens says:

    Thank you, works perfect.

    Note: If the proxy requires authentication, you have to create a file with the content

    Make this file readable only by yourself by
    chmod a-r
    chmod u+r

    and then alter the line in ~/.ssh/config to
    ProxyCommand /usr/local/bin/corkscrew 80 %h %p

    (From the corkscrew man page)

  3. Shailendra says:


    Worked perfect.

  4. Jeremy says:

    Thanks, worked perfectly!

  5. Thomas says:

    I can’t get it to work. I’m a nub when it comes to using CMD. I can’t get the kode to work. please help me:D

  6. Chris says:

    Can you say… awesome!

  7. Josu says:

    Hello, thanks for this article.

    But I have problems connecting to diferent port:

    $ ssh -p 8080 myserver
    Proxy could not open connnection to Forbidden
    ssh_exchange_identification: Connection closed by remote host

    I have a proxy and a firewall. I configured my server SSh service on 8080.

    If I write on a firefox “myserver” i have:

    SSH-2.0-OpenSSH_5.1p1 Debian-5

    Thanks for all.

  8. ron says:

    when it comes to using CMD.

    Your need an ssh client for windows first.

  9. hata says:

    i had install corkscrew on solaris 10, but
    when i try to connect to other server.

    message like this.

    # /usr/local/bin/corkscrew 800 22
    Proxy could not open connnection to Forbidden

    any help, please….

  10. ander sess says:

    In windows, you can use ssh tunnel easy to bypass https proxy, unique support samba over ssh, get it from

  11. tomas says:

    Proxy could not open connnection error i solved with AllowCONNECT 22 directive in apache configuration file proxy.conf

Leave a Comment