pssh: Execute a command on multiple hosts on terminal

If you deal with the task of manage multiple machines in a local network, it is usual need to apply a given settings over all hosts, or install a new program on the entire network. We’ve posted before a tool called cluster-ssh which hold it via interface (or exporting X). However, if you could not export X you can use pssh, a tool that dispatch a command to multiple hosts in terminal. It can be found on Ubuntu repositories, but in Karmic Koala it does not work. The installation completes, but it does not create the binary in /bin, /usr/bin neither in /usr/local/bin). The turnaround is presented below:

sudo add-apt-repository ppa:thelupine/ppa
sudo apt-get update
sudo apt-get install pssh

After installing it, you can check, for instance, who is accessing each machine, what’s the load on each machine, what are the mounted devices and so. First you need to create a file with a list of all hosts:

### hosts.txt ### 

Then you can dispatch the command to be distributed:

pssh -h hosts.txt -i "df -h"

Read more:

See ya

Cluster SSH: execute the same command in multiple hosts

The routine of a network administrator include need to apply the same change over multiple hosts, such as install a certain package or setup an application. One alternative is make a script that spread your command in a list of hosts. However, the same command can have different results on different hosts, so it’s useful to follow, in the screen, if it was successful applied. Cluster SSH provide this issue. It can be instaled using apt-get:

sudo apt-get install clusterssh

Following some previews:

See ya

Ubuntu : Automatic login to SSH without a password


Here goes a tip that is useful when you make frequently ssh access to avoid having to enter the password all the time. First generate a public key from your local machine. Then copy this key to the remote machine which you want to login automaticaly. Now append you public key to the authorized_keys. It’s recommended that you remove the key file from the remote machine. Now you can do automatic login to ssh.

local$ ssh-keygen -t dsa
local$ scp ~/.ssh/   # Don't forget the ":"
cat >> .ssh/authorized_keys
remote$ rm

After generating the public key you can do the three steps above (to append the public key in authorized_keys file) in a single command as follows:

ssh-copy-id yourserver

See ya

See more: