2

I am trying to install a particular software across all our machines one by one so I decided to use pdsh. By default, it will operate on several machines at once in parallel, but I will be using the -f option to limit it to running on each machine one at a time.

Just to play with it, I decided to run below command but I am getting an error:

david@machine0:~$ sudo pdcp -w machine1 abc.tar.gz /home/david
machine1: Host key verification failed.
pdcp@machine0: machine1: ssh exited with exit code 255

What is wrong I am doing here?

Jakuje
  • 20,974
  • 7
  • 51
  • 70
user1950349
  • 771
  • 2
  • 9
  • 16

2 Answers2

3

If you search around, what does

Host key verification failed

mean, you will find enough information to resolve your problem. The problem in you case is that you run pdcp under root user (sudo). Is it really what you want? If not, run it without sudo and it will Just WorkTM.

If you really need to run pdcp under sudo, you need to do the host key verification also under sudo:

sudo ssh machine1

will let you do that. It will prompt you for the key verification and then it will store new entry in ~/.ssh/known_hosts. Your pdcp should work from that time.


Last note from manual page for pdcp:

When using ssh for remote execution, stderr of ssh to be folded in with that of the remote command. When invoked by pdcp, it is not possible for ssh to prompt for confirmation if a host key changes, prompt for passwords if RSA keys are not configured properly, etc.. Finally, the connect timeout is only adjustable with ssh when the underlying ssh implementation supports it, and pdsh has been built to use the correct option.

You need to set up pubkey authentication if you want to use pdcp.

Jakuje
  • 20,974
  • 7
  • 51
  • 70
  • I already did `ssh machine1` and I am able to login fine without any issues. And then if I do pdsh after that, I still get same error as shown above. – user1950349 Apr 30 '16 at 17:09
  • so check it with `PDSH_SSH_ARGS_APPEND=-vvv` env variable, what is really going on under the hood and add the output to the edited question. – Jakuje Apr 30 '16 at 17:14
  • hmmm I am not a linux guy. What is that variable? I mean what should I run? If you can provide step by step, I will be able to learn something new. – user1950349 Apr 30 '16 at 17:16
  • I edited the answer, because I spot the problem already. Check the `sudo`, if you need it, do `ssh` under `sudo`. If not, run `pdsh` without `sudo`. – Jakuje Apr 30 '16 at 17:20
1

The "Host key verification failed" is from the underlying SSH process. See pdcp(1):

When using ssh for remote execution, stderr of ssh to be folded in with that of the remote command. When invoked by pdcp, it is not possible for ssh to prompt for confirmation if a host key changes, prompt for passwords if RSA keys are not configured properly, etc..

A solution would be to connect to all hosts in all_hosts once before and to accept their host keys or to disable (!) StrictHostKeyChecking for said hosts:

$ cat ~/.ssh/config 
Host david micheal jose
        StrictHostKeyChecking   no

$ pdcp -R ssh -w ^all_hosts abc.tar.gz /home/david
sid0: Warning: Permanently added 'david,x.x.x.x' (ED25519) to the list of known hosts.
[...]
Rahul
  • 13,309
  • 3
  • 43
  • 54
  • I did `ssh machine1` and I was able to login fine but after that when I do same pdcp command I still see same error above. – user1950349 Apr 30 '16 at 17:10