Example usage: $ on-demand-ssh-tunnel '[ SSHTunnel 59000 "127.0.0.1:5900" ["user@host1", "while true; do date; sleep 60; done"] ]' When something connects to 127.0.0.1:59000 on-demand-ssh-tunnel will start ssh subprocess ssh -v -Lrandom-tunnel-port:127.0.0.1:5900 -n user@host1 to tunnel communication to VNC server accessible on port 5900 (on host1).