开发者

Disabling unidentified host confirmation when connecting to Amazon EC2 instances using SSH

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 root@ec2-174-129-121-25.compute-1.amazonaws.com

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?


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.


For PuTTY and windows you can use

echo y | plink -pw yourpassword root@yourservername.com
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜