So lately i have needed to setup some detailed entries into my ssh config file but i needed to ssh in and keep a term open for them to work.

Instead, i added these functions that when your ssh config is properly setup will auto create these tunnels for you:


function start_tunnel() { if [ -z $1 ] ; then echo "need hostname" ; else ssh -f -N -M -S /tmp/file-${1} ${1} ; fi }


function stop_tunnel() { if [ -z $1 ] ; then echo "need hostname" ; else ssh -S /tmp/file-${1} -O exit ${1} ; fi }

the only thing that needs to be properly set up for this to work is the ssh config file since those functions read the Host section.

The following two tabs change content below.

charlie root

VP of keeping it real / HNIC at pissedoffadmins.com
I bring the cold coffee.

Latest posts by charlie root (see all)

No Comment.

Add Your Comment