Search code examples
amazon-ec2rsync

no password ssh auth in new amazon instances


I have a script that interact with an external host with rsync/ssh.

SSH prompts me to confirm the authenticity of the host like this:

The authenticity of host 'xxxxxxxxxxxxxxxxxx' can't be established.
RSA key fingerprint is xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Are you sure you want to continue connecting (yes/no)? 

Since every EC2 instance is a new host, I have to confirm this every time, but I want an automatic script without any user input. What is the best solution?

I know I can add -O StrictHostKeyChecking=no , but that would make external host insecure.

EDIT ! : is it possible to use my PEM file to authenticate in other servers ? I mean, mayb installing something in the external server and connect in the same way I do with instances and the PEM file

Thank you


Solution

  • I think this article verify-ssh-keys-on-ec2-instances might have the information you need, or at least a starting point to scripting something.