chef: The authenticity of host 'x.x.x.x' can't be established

Jack asked:

I’m running knife bootstrap command I’m getting following error

Connecting to x.x.x.x WARN: [SSH] PTY requested: stderr will be merged
into stdout The authenticity of host ‘x.x.x.x ()’ can’t be
established. fingerprint is

Are you sure you want to continue connecting ? (Y/N)

if I input Y it works but I want to run this command without prompting an input; how can I do that?

my command

knife bootstrap x.x.x.x -x root -N node1 --sudo '--run-list=chef-client,role[access]' -E test -i /root/.ssh/id_rsa

My answer:

You receive this warning because the ssh host key for the remote host is not known to your user locally, and not stored in the $HOME/.ssh/known_hosts file.

If you’re bringing up a new server you can use ssh-keyscan to get its host keys and store them away in a file. A trivial example:

ssh-keyscan HOSTNAME >> $HOME/.ssh/known_hosts

The command has many options suitable for automation, such as passing a list of hostnames to scan; read its man page to see what options are available to you.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.