An elegant way to control a bunch of ssh connections

Lets say you want to establish ssh tunnel and put it into background: ssh -fNL 12345:localhost:54321 user@remote When you are done using tunnel you could use: pkill -f "ssh -fNL 12345:localhost:54321 user@remote" but it just doesn’t look right :) Things get a lot more messy when you need to have a bunch of ssh sessions. Lets say you have some client program and server program, and you want to use ssh to tunnel a connection from host1 to host2....

November 28, 2014 · 3 min · 535 words · Ruslan Kuprieiev