Let’s suppose you have received a bunch of Linux servers you need now to administer… the problem tough, is that to access those servers you need to open a ssh session to a “Jump Server”, then from jump server, you will reach all the needed servers…
This is what I did:
Pre-requisites:
1. ssh public keys installed on the jump server, and also in all the other servers…
Note: Although you really don’t need the keys for this approach to work, it’s very recommended… BTW who still using passwords??
To configure in your linux machine:
1. If not created, create a file named “config” under your user .ssh directory, and put the following contents…
vim /home/username/.ssh/config
and copy this contents:
Host host_you_need_to_connect_to ProtocolKeepAlives 15 ServerAliveInterval 15 ProxyCommand ssh -e none user@jumpserver exec nc %h %p
Quick explanation:
Host: In this option you configure the hostname or hosts names you want to connect to. The * it’s also useful. Example: server_*
Alive Options: This will keep you out of errors like this: Write failed: Broken pipe
ProxyCommand: This is where the magic happens, first it will open a ssh connection to the jump server, and execute netcat command to second server, or better to say to the host you want to connect to….