Multiplexing ssh connections in one tunnel
By Kereoz on Thursday 29 April 2010, 10:21 - Tech - Permalink
Say you run a script with multiple ssh accesses to the same machine. You don't want to store the public key of the local machine on the server for security reasons, but you don't want to type the password every time a connection is made.
Adding those lines to ~/.ssh/config will do the trick
Host *
ControlMaster auto ControlPath ~/.ssh/master-%r@%h:%p
See man ssh_config (5) for more details.