views:

135

answers:

2

I am writing a script using boto and Python to automatically launch an Amazon EC2 instance and interact with it using SSH. Everything works fine except that every time I establish the connection, SSH prompts me to confirm the authenticity of the host like this:

The authenticity of host 'ec2-174-129-121-25.compute-1.amazonaws.com (174.129.121.25)' can't be established.
RSA key fingerprint is 26:09:bd:21:4f:55:20:3f:0d:fc:5f:cc:3e:08:30:db.
Are you sure you want to continue connecting (yes/no)? 

My SSH command is:

ssh -i ssh2.pem [email protected]

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?

+1  A: 

Use -O StrictHostKeyChecking=no and, optionally, set the KnownHostsFile of /dev/null (if you want to be totally insecure about things). But remember, you're bypassing security measures meant to protect you!

edit and probably CheckHostIP=no too. man ssh and see all the gory bits.

fennec
I think you also want `CheckHostIP=no`
kdgregory
A: 

For PuTTY and windows you can use

echo y | plink -pw yourpassword [email protected]