天天看點

ssh加速,自動添加到know_hosts

經常遇到這樣的問題,如下,很是麻煩,找到了解決辦法。

<b>[root@xytr1 ~]#</b> ssh 192.168.5.56

The authenticity of host '192.168.5.56 (192.168.5.56)' can't be established.

RSA key fingerprint is a1:7f:35:ec:1a:5e:33:df:e8:82:56:cf:b6:99:b6:b9.

Are you sure you want to continue connecting (yes/no)? <b>yes ß<b> </b><b>這裡一定要确認才能通過</b></b>

Warning: Permanently added '192.168.5.56' (RSA) to the list of known hosts.

Last login: Tue Jul 13 16:29:52 2010 from linux1

解決方案是,把 <b>本地</b><b> </b>的ssh用戶端配置檔案 <b>ssh_config</b> 做修改

<b>[root@xytr1 ~]#</b> vi /etc/ssh/ssh_config

找到:

#   StrictHostKeyChecking ask

修改為

    StrictHostKeyChecking no

這樣下次就不會出現需要确認的提示了。

這個選項會自動的把 ssh 的機器添加到 /root/.ssh/know_hosts 中(也就是不需要你手工的輸入yes)

如果遠端機器遭到了修改,也會有錯誤提示,不過不會影響ssh登陸,如下

<b>[root@xytr1 ~]#</b> ssh 192.168.5.56   <b>ß</b><b> </b><b>這裡我再次</b><b>ssh</b><b>到這台機器</b>

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @

IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!

Someone could be eavesdropping on you right now (man-in-the-middle attack)!

It is also possible that the RSA host key has just been changed.

The fingerprint for the RSA key sent by the remote host is

a1:7f:35:ec:1a:5e:33:df:e8:82:56:cf:b6:99:b6:b9.

Please contact your system administrator.

Add correct host key in /root/.ssh/known_hosts to get rid of this message.

Offending key in /root/.ssh/known_hosts:137

Password authentication is disabled to avoid man-in-the-middle attacks.

Keyboard-interactive authentication is disabled to avoid man-in-the-middle attacks.

Last login: Tue Jul 13 16:45:31 2010 from linux1

<b>[root@searchweb16 ~]#   </b><b>ß</b><b> </b><b>如上所示,出現了提示,但是我們還是可以正常的</b><b>ssh</b><b>到遠端。</b>

<b></b> 

同時如果修改 ssh_config 中的 GSSAPIAuthentication 參數為 no 或者直接登出該參數,可以解決有時候ssh狂慢的問題。Authentication 參數是用于 Kerberos 驗證的,而我們不可能使用這種驗證機制

本文轉自 justiceplus 51CTO部落格,原文連結:http://blog.51cto.com/johnwang/348712,如需轉載請自行聯系原作者

繼續閱讀