SSH – SSH Client to Duplicate Commands to Multiple Terminals

administrationssh

I'd like to control several ssh connections from one terminal. For example, I would type ifconfig in the main terminal and all the other ssh connections would run ifconfig. That's what offered PuttyCM on Windows for example.

This may be a very simple question but I did not manage to find such a ssh connection manager. I would not be too hard to code but it surely already exists. Could you give some hints?

Best Answer

Cluster SSH

Cluster SSH is used to start multiple SSH connections in separate terminal windows, with a common input box. You type in the input box and the keystrokes are sent to all the connected terminals.

sudo apt-get install clusterssh

Then run cssh:

cssh host1 host2 ...

Use a terminal emulator with broadcasting

Terminator, for example, is a terminal emulator in which you can broadcast keystrokes to a group of terminals.:

enter image description here enter image description here


Depending on how many connections you make, Cluster SSH might be the better option. However, it uses xterm for the terminal emulator, which may not be what you are used to. It is, however, much more easy to get started with a number of connections using cssh, than to create a lot of splits and group them in Terminator. For example, this is what cssh osl-{01..95} gets me:

enter image description here

The terminal windows were are all resized and tiled nicely. The gaps are for windows that were closed because the connection failed.