ssh : how to add "hostkey" to “know_hosts”

有时后端daemon或者脚本在执行ssh连接时,会遇到以下提示:

The authenticity of host 'git.sws.com (10.42.1.88)' can't be established.
ECDSA key fingerprint is 53:b9:f9:30:67:ec:34:88:e8:bc:2a:a4:6f:3e:97:95.
Are you sure you want to continue connecting (yes/no)? yes

而此时必须输入yes,连接才能建立。其实在ssh_config配置文件中可以配置此项,打开/etc/ssh/ssh_config文件:

找到:
# StrictHostKeyChecking ask
修改为
StrictHostKeyChecking no
 
这个选项会自动的把 ssh 的机器添加到 /root/.ssh/know_hosts 中。
 
 
None
 
 
 
 
 
 
 
 
 

如果您愿意花几块钱请我喝杯茶的话,可以用手机扫描下方的二维码,通过 支付宝 捐赠。我会努力写出更好的文章。 
(捐赠不显示捐赠者的个人信息,如需要,请注明您的联系方式) 
Thank you for your kindly donation!!

 

 ssh : how to add

 

 

 
 
 
 

你可能感兴趣的:(ssh : how to add "hostkey" to “know_hosts”)