The question Using an already established SSH channel has an answer that intrigued me. It suggests that I can reuse an existing SSH connection. However, after further reading, I see that this solution may not work in my case (multiple tunnels at the same time).
I'm using OpenSSH_5.9p1 Debian-5ubuntu1.1, OpenSSL 1.0.1 14 Mar 2012 (on Kubuntu 12.04).
Here is what I'm currently doing in a bash script:
echo "establishing SSH tunnel for SFTP && opening Dolpin with SFTP connection to remote computer..."
ssh -i "$ID_RSA" "$MIDDLEMAN_USER@$MIDDLEMAN_SERVER" -fL $PORT_NUMBER:localhost:$PORT_NUMBER sleep 20; dolphin sftp://HostSftp:$PORT_NUMBER &
echo "establishing SSH tunnel for VNC && connecting to VNC server for remote desktop support..."
sudo ssh -fL 5901:localhost:$VNC_PORT_NUMBER -i "$ID_RSA" "$MIDDLEMAN_USER@$MIDDLEMAN_SERVER" sleep 20; vncviewer localhost:5901
My concerns (why I think this might not work for me) include things like this:
A negative to this is that some uses of ssh may fail to work with your multiplexed connection. Most notably commands which use tunneling like git, svn or rsync, or forwarding a port. Source
and this:
If you use LocalForward or RemoteForward in your configuration file, you might run into a subtle problem. ... SSH1 (but not OpenSSH) provides a solution. Source
I'm looking for clarification as well as instruction:
- Can I establish the two tunnels above with one master connection?
- Will this be as reliable as establishing separate connections?
- If yes to both the above, how do I do it?
Thanks