Everyday I lunch from 5 to 10 ssh tunneling connections to remote servers, with commands like the following:

ssh -Nvvv -L localhost:8866: host

Some of these servers I use as proxies to browse the web, in others I run things like jupyter, tensorboard, or other similar programs which I can then access from my personal computer on the browser on the mapped port.

But it's annoying having to launch all the connections every time, and remember what port is mapped to what server.

Are there any tools out there, GUI or terminal based, for managing these kind of connections?

1 Answer 1


A simple method might be to create a Bash script that starts them all. With the example script below written for two connections, if you call it tunnel and chmod +x tunnel then you can use

tunnel start

to start them (idempotently) and

tunnel stop

to clean them up.

C1="localhost:8866: host1"
C2="localhost:8867: host2"
pkill -f "$C1"
pkill -f "$C2"
if [ "$1" = stop ]; then exit 0; fi
sleep 3  # give some time for them to exit, if applicable
nohup ssh -N -L $C1 &> /dev/null &
nohup ssh -N -L $C2 &> /dev/null &

Another method might be to use autossh to keep them going individually, and possibly arrange for them to begin at system startup.

Finally, you might be able to give the ports symbolic names in /etc/services, although then we're starting to create a bit of a configuration mess on your system. You might prefer the ports to be in the reserved range (< 1024), necessitating root privileges.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.