利用虚拟机物理克隆一份后
ssh免密登录出现此类问题
[root@hadoop2 ~]# ssh hadoop3
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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
33:78:e5:9a:e8:c5:47:73:81:a3:9b:4c:b0:ed:af:2d.
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:2
Password authentication is disabled to avoid man-in-the-middle attacks.
Keyboard-interactive authentication is disabled to avoid man-in-the-middle attacks.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
后经查证
因为服务器主体发生变更了
第一次SSH连接时,会生成一个认证,储存在客户端(也就是用SSH连线其他电脑的那个,自己操作的那个)中的known_hosts,但是如果服务器验证过了,认证资讯当然也会更改,服务器端与客户端不同时,就会跳出错误啦。要删除很简单,只要在客户端输入一个指令
ssh-keygen -R +输入服务器的IP
eg:hadoop2 ssh hadoop3出现问题
在hadoop2中 known_hosts文件中删除对应ip
[root@hadoop2 ~]# ssh-keygen -R hadoop3
重新分发秘钥至hadoop3
[root@hadoop2 ~]# ssh-copy-id hadoop3
重新登录
[root@hadoop2 ~]# ssh hadoop3
Last login: Tue Sep 3 05:27:01 2019 from hadoop1
[root@hadoop3 ~]#
成功~