automate "yes" for new host when SSH

时间:2015-12-10 01:18:26

标签: bash shell ssh

I am trying to automate SSH into a new IP. I get this message

The authenticity of host '12.82.147.35 (88.88.999.88)' can't be established.
ECDSA key fingerprint is b6:b3:06:e1:31:2b:f8:32:a5:c0:ae:dc:46:6d:b7:39.
Are you sure you want to continue connecting (yes/no)?

How do I automatically answer yes

to this question?

1 个答案:

答案 0 :(得分:1)

Try 'man ssh-keyscan' - it is a tool for building a known hosts file - from the man page:

ssh-keyscan uses non-blocking socket I/O to contact as many hosts as possible in parallel, so it is very efficient. The keys from a domain of 1,000 hosts can be collected in tens of seconds, even when some of those hosts are down or do not run ssh. For scanning, one does not need login access to the machines that are being scanned, nor does the scanning process involve any encryption.

Note that you still have to authenticate and/or establish your key relationship for key based logins.