Thursday, December 05, 2013

Multiple Simultaneous Interactive SSH sessions

As I've been doing more and more Sys Ops on Ohloh.net, I have had the strong desire to avoid having to repeatedly ssh into multiple systems in order to do the same actions over and over again.  So, I started searching for "parallel interactive SSH" and other variations.

Cutting to the solution for OSX, I found csshx (The project is also on Ohloh.net).

Here's an example of using it:
Some notes:

  • csshX opens a small, red command window at the bottom. This needs to be the active window to get the commands to go all client windows
  • The command window has a "control mode" that lets do things like re-tile, sort, add and remove windows and exit (you'll be prompted individually for each window).  You can also simply type "exit" to exit the shell in all the terminal windows and then close each one.
  • You can click into one of the client windows to issue a custom command on only that system
  • I have my ssh public key on the target machines, but it also worked on those machines without the public key, passing my login password through to all ssh clients
  • When launching csshX from the terminal, use your "primary" screen. I found when launching it from my secondary monitor in OSX Mavericks (10.9) that the child windows immediately closed. Perhaps they couldn't resize correctly. 
  • I've tried this with up to 15 windows, YMMV, but that looks like my maximum, given that this was running on my primary window - the laptop screen.  If you switch to a massive secondary screen, you may be able to squeeze in more.