Apasionado por la tecnología, los proyectos y el liderazgo. Fundador de YAKINDU CIA. LTDA. y SIGHTBOT S.A.S. Ingeniero en Sistemas y Máster en Innovación y Transformación Digital. Soy el CEO de YAKINDU e Ingeniero de Software en Creditú. He liderado varios proyectos tecnológicos para empresas públicas y privadas. Creo que el Ecuador puede transformarse digitalmente para ser mas competitivos y entregar valor al mundo.
SSH Tunneling
SSH Tunneling

SSH Tunneling

Imagine that you want access from local (your computer) to remote host 2. But you just have access from remote host 1 to host 2. Also you have access from localhost to host 1. So SSH Tunneling lets you use these connection to connect localhost to host 2. To create the SSH tunnel execute following in local machine.

ssh -L 9001:host2_IP:22 -N user@host1_IP -p5050

where: 

-N - do not execute a remote command, (you will not have the shell, see below)

-L Indicates that a local port forward is need to be created. The switch syntax is as follows.

-L <local-port-to-listen>:<remote-host>:<remote-port>

Now the SSH client at localhost will connect to SSH server running at host1_IP (running at port 5050) binding port 9001 of localhost to listen for local requests thus creating a SSH tunnel between host1_IP and localhost. At the host1_IP end it will create a connection to host2_IP at port 22. So localhost doesn’t need to know how to connect to ‘host2_IP’. Only localhost needs to worry about that.

Now it is possible to connect to host2_IP via ssh using this command:

shh localhost -p9001