Tunneling SSH Connection Behind a Proxy

Been running a system behind a proxy server and some of these CLI packages neither use the GNOME system proxy or environment variables of proxy. SSH is one of them and I use it mostly, so how do I use it behind a proxy?


Corkscrew is a simple tool to tunnel TCP connections through an HTTP proxy supporting the CONNECT method. It reads stdin and writes to stdout during the connection, just like netcat. It can be used for instance to connect to an SSH server running on a remote 443 port through a strict HTTPS proxy.

Install corkscrew

$ sudo apt-get install corkscrew

Setting Up SSH

Append this line to your /etc/ssh/ssh_config (if you wish to apply globally to all users) or ~/.ssh/config (for you alone)

Host *
        ProxyCommand corkscrew proxy_host proxy_port %h %p

Save and connect to your remote server successfully! 🙂