5

I am trying to run an Parallel SSH with Amazon Instances, But I am getting Permission denied expception, How ever I can SSH it to the server. How we can run PSSH with key login. So far I have tried like,

pssh -h hosts-file -i xxx.pem -l username date
Ananth Duari
  • 161
  • 1
  • 1
  • 3

3 Answers3

14

use the -x argument.

Example

pssh  -i  -H ubuntu@xxxxxxx.compute-1.amazonaws.com  -x "-oStrictHostKeyChecking=no  -i /home/ccc/xxx/something-us-east.pem" 'echo hi'

Whatever u put in -x gets passed as arguments to the underlying ssh process.

sajal
  • 602
  • 7
  • 12
9

The -i parameter of parallel-ssh doesn't specify the keyfile like it does for ssh. You need to add something like this to your ~/.ssh/config to get SSH to use the right keyfile.

Host *.compute-1.amazonaws.com
    IdentityFile ~/.ssh/ec2.pem
mgorven
  • 30,615
  • 7
  • 79
  • 122
0

Please ensure that you can ssh to each of these instances using ssh and ensure that the same xxx.pem works for all instances. Once you do that, the pssh command will work. You may have to copy your public key to each instance and add an entry to the .ssh/authorized_keys file.

mnain
  • 49
  • 1