Speed Up Multiple SSH Connections to the Same Server
If you run a lot of terminal tabs or scripts that all need to make OpenSSH connections to the same server, you can speed them all up with multiplexing: making the first one act as the master and letting the others share its TCP connection to the server.
If you don't already have a config file in the .ssh directory in your home directory, create it with permissions 600: readable and writeable only by you.
Then, add these lines:
Host * ControlMaster auto ControlPath ~/.ssh/master-%r@%h:%p
ControlMaster auto tells ssh to try to start a master if none is running, or to use an existing master otherwise. ControlPath is the location of a socket for the ssh processes to communicate among themselves. The %r, %h and %p are replaced with your user name, the host to which you're connecting and the port number—only ssh sessions from the same user to the same host on the same port can or should share a TCP connection, so each group of multiplexed ssh processes needs a separate socket.
To make sure it worked, start one ssh session and keep it running. Then, in another window, open another connection with the -v option:
~$ ssh -v example.com echo "hi"
And, instead of the long verbose messages of a normal ssh session, you'll see a few lines, ending
debug1: auto-mux: Trying existing master hi
If you have to connect to an old ssh implementation that doesn't support multiplexed connections, you can make a separate Host section:
Host antique.example.com ControlMaster no
For more info, see man ssh and man ssh_config.
Win an iPhone 6
Enter to Win
|Non-Linux FOSS: Install Windows? Yeah, Open Source Can Do That.||Nov 24, 2015|
|Cipher Security: How to harden TLS and SSH||Nov 23, 2015|
|Web Stores Held Hostage||Nov 19, 2015|
|diff -u: What's New in Kernel Development||Nov 17, 2015|
|Recipy for Science||Nov 16, 2015|
|Firefox's New Feature for Tighter Security||Nov 13, 2015|
- Non-Linux FOSS: Install Windows? Yeah, Open Source Can Do That.
- Cipher Security: How to harden TLS and SSH
- Simple Photo Editing, Linux Edition!
- Web Stores Held Hostage
- Firefox's New Feature for Tighter Security
- Libreboot on an x60, Part II: the Installation
- diff -u: What's New in Kernel Development
- It's a Bird. It's Another Bird!
- How Will the Big Data Craze Play Out?
- November 2015 Issue of Linux Journal: System Administration