1. 程式人生 > >Linux_SSH Warning: the RSA host key for differs from the key for the IP address

Linux_SSH Warning: the RSA host key for differs from the key for the IP address

[[email protected] .ssh]$ ssh [email protected] ls /tmp
The authenticity of host 'sjisbe381 (10.100.87.11)' can't be established.
RSA key fingerprint is 8f:bd:9b:06:92:1d:0b:6e:0e:d0:f3:d1:cd:f7:f7:6e.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'sjisbe381' (RSA) to the list of known hosts.
Warning: the RSA host key for 'sjisbe381' differs from the key for the IP address '10.100.87.11'
Offending key for IP in /builds/hudson/.ssh/known_hosts:36
Are you sure you want to continue connecting (yes/no)? 

當ssh訪問一臺server時,如果出現“Warning: the RSA host key for differs from the key for the IP address”這樣的資訊,表示在known_hosts裡已經有一臺server和你正要訪問的server的IP衝突。


另外一條類似於這樣的資訊“Offending key for IP in /builds/hudson/.ssh/known_hosts:36″,表示IP衝突位於known_hosts的第36行, 只要開啟~/.ssh/known_hosts,刪除第36行就可以將問題解決,或者直接執行一條命令搞定“sed -i -e ’36d’ ~/.ssh/known_hosts”。

如果你想徹底擺脫known_hosts,將“StrictHostKeyChecking no”新增到~/.ssh/config,這樣以後訪問新的server都不在有known_hosts的提示。