➥ How to install and configure pssh using ssh keys to login on ubuntu

For the installation you need only two commands that will install pssh.

$ sudo apt-get install python-pip
$ sudo pip install pssh

Generating RSA Keys

cd /home/YourUserName/.ssh
chmod 700 ~/.ssh
ssh-keygen -t rsa -b 4096

You will be prompted for a location to save the keys, and a pass-phrase for the keys. This pass-phrase will protect your private key while it's stored on the hard drive:


Generating public/private rsa key pair.
Enter file in which to save the key (/home/b/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/b/.ssh/id_rsa.
Your public key has been saved in /home/b/.ssh/id_rsa.pub.

Your public key is now available as .ssh/id_rsa.pub in your home folder.

Transfer Client Key to Host
ssh-copy-id <username>@<host>

You will be asked for the remote host password, after typing it once you can try connecting with # ssh root@host and it will log you in without asking for password.
Do this to all of your hosts which you will put in the hosts.txt file.

Now create a host.txt, put your hosts there and run file and run
pssh --hosts hosts.txt --user root -i "uptime"