Faster SSH connection to the same server

Recently I was in search of some ways to speed up my SSH connections as I spend a lot of my days within the terminal.  I came across this handy little gem which can help you connect faster to a server that you already have a connection to.  There is a feature within OpenSSH called connection sharing and its really easy to enable, and requires no edits to the server.

To enable OpenSSH connection sharing, edit your SSH config file:


Add the following lines of code to it:

ControlMaster auto
ControlPath /tmp/ssh_mux_%h_%p_%r

Once you have made the modification to the SSH config file, disconnect from the current connection and for good measure close out of your terminal.  Now you can open up your terminal and connect to a server, open up a new tab and connect to the same server.  The new connection should connect much quicker than the first one.