Can I automatically add a new host to known_hosts ?

Posted by gareth_bowles on Server Fault See other posts from Server Fault or by gareth_bowles
Published on 2010-04-16T04:15:11Z Indexed on 2010/04/16 4:23 UTC
Read the original article Hit count: 263

Filed under:
|
|
|

Here's my situation; I'm setting up a test harness that will, from a central client, launch a number of virtual machine instances and then execute commands on them via SSH. The virtual machines will have previously unused hostnames and IP addresses, so they won't be in the ~/.ssh/known_hosts file on the central client.

The problem I'm having is that the first SSH command run against a new virtual instance always comes up with an interactive prompt:

The authenticity of host '[hostname] ([IP address])' can't be established.
RSA key fingerprint is [key fingerprint].
Are you sure you want to continue connecting (yes/no)?

Is there a way that I can bypass this and get the new host to be already known to the client machine, maybe by using a public key that's already baked into the virtual machine image ? I'd really like to avoid having to use Expect or whatever to answer the interactive prompt if I can.

© Server Fault or respective owner

Related posts about linux

Related posts about ssh