5

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?

10

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.

5

There are many options to achieve what you want. My favorite is pssh (Parallel SSH). It can run commands parallely on multiple hosts and have variety of options.

You can install it by:

sudo apt-get install pssh

pssh has some added advantages like it will be installed with parallel-scp, parallel-rsync binaries to do as their names suggest.

Here is an example to run whoami command as user foobar on two hosts using pssh:

parallel-ssh -iAH "host_1 host_2" -l foobar "whoami"

Check man pssh or here to get more idea.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.