Ubuntu/Applications/PDSH
(→Step 1: Password-less SSH) |
|||
Line 21: | Line 21: | ||
Copy the public key to the remote-host (computer you will be connecting TO). | Copy the public key to the remote-host (computer you will be connecting TO). | ||
<nowiki>~$ ssh-copy-id -i ~/.ssh/id_rsa.pub remote-host | <nowiki>~$ ssh-copy-id -i ~/.ssh/id_rsa.pub remote-host | ||
− | a@remote-host's password: | + | a@remote-host's password: [Enter Password] |
Now try logging into the machine, with "ssh 'remote-host'", and check in: | Now try logging into the machine, with "ssh 'remote-host'", and check in: | ||
Latest revision as of 17:36, 30 July 2015
Applications | Java7 | Conky | Console Browsers | Fail2Ban | PDSH
Contents |
[edit] Overview
PDSH is currently (2015) one of the most popular solutions for Parallel Distributed Shell. It allows you to execute remote commands on a group or cluster of servers at the same time.
[edit] Step 1: Password-less SSH
PDSH is not coded to handle authentication prompts, so it requires that you setup pair of authentication keys rather than using /passwd.
Create the ssh public/private keys on the host (computer you will be connecting FROM).
~$ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/home/a/.ssh/id_rsa): [Enter key] Created directory '/home/a/.ssh'. Enter passphrase (empty for no passphrase): [Press enter key] Enter same passphrase again: [Press enter key] Your identification has been saved in /home/a/.ssh/id_rsa. Your public key has been saved in /home/a/.ssh/id_rsa.pub. The key fingerprint is: 3e:4f:05:79:3a:9f:96:7c:3b:ad:e9:58:37:bc:37:e4 a@A
Copy the public key to the remote-host (computer you will be connecting TO).
~$ ssh-copy-id -i ~/.ssh/id_rsa.pub remote-host a@remote-host's password: [Enter Password] Now try logging into the machine, with "ssh 'remote-host'", and check in: .ssh/authorized_keys to make sure we haven't added extra keys that you weren't expecting.
You should now be able to ssh into the remote-host without a password:
~$ ssh remote-host Last login: Sun Nov 16 17:22:33 2008 from 192.168.1.2 [Note: SSH did not ask for password.] a@remote-host$ [Note: You are on remote-host here]
[edit] Step 2: Install PDSH on Host
Simple.
~$ sudo apt-get update && sudo apt-get install pdsh -y
[edit] Step 3: send a test command from the host to a few servers
PDSH allows you to create a HOSTLIST which you can use to easily call groups of computers. I'm not going to cover that, but you can find more information about it by visiting their wiki here.
Send a test and see what OS each computer is running
~$ pdsh -w ssh:username@host1,host2,host3 'grep . /proc/sys/kernel/ostype'
If all the hostnames are similar except for the last digits, you can also do it this way:
~$ pdsh -w ssh:username@host[1-3] 'grep . /proc/sys/kernel/ostype'