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.

wget http://www.meadowy.org/~gotoh/ssh/connect.c

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 proxy01.sohailriaz.com:8080 %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 🙂

pixelstats trackingpixel
Pin It

related posts

Leave a Reply

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

« »