ssh自动添加hostkey到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 中。
 
 
posted @ 2013-02-28 12:08  牛皮糖NewPtone  阅读(11050)  评论(0编辑  收藏  举报