HowTo SSH outside using Authenticated Proxy

on January 4 | in Linux, Programming / Scripting | by | with No Comments

This howto describe how to ssh outside another network / server using authenticated proxy. SSH (Secure Shell) is typically used to log into a remote machine and execute commands, but it also supports tunneling, forwarding TCP ports and X11 connections; it can transfer files using the associated SFTP or SCP protocols.

Normally we use NetCat to ssh outside using proxy server but if its not support proxy user / pass to authenticate by proxy server and then ssh outside. Here we will use a package called connect.c.

connect.c is the simple relaying command to make network connection via SOCKS and https proxy. It is mainly intended to be used as proxy command of OpenSSH. You can make SSH session beyond the firewall with this command.

This can be achieved by other methods too but this works for me.

1) Download connect.c software.


2) Compile connect.c Using GCC

gcc connect.c -o connect

and then copy to directory in your PATH i.e /usr/bin or /usr/local/bin

cp connect /usr/bin

3) Congiure ssh_config

append following line

ProxyCommand /usr/bin/connect -H %h %p

4) Export Proxy User / Pass as variable

It is insecure but we have to used it. If your proxy doesnt use user/pass for authenticatio, you can skip this.

export HTTP_PROXY_USER=your_username
export HTTP_PROXY_PASSWORD=your_password

Thats it now you can ssh outside without any restriction 🙂

Pin It

related posts

Leave a Reply

Your email address will not be published. Required fields are marked *

« »