SSH连接远程机器报错:Host key verification failed.

C:\Users\xxx>ssh root@10.239.168.39
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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 a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
SHA256:Vlrl2MRlgUIabY2IgyP4OUm79938tPNVyhw92wz3Guc.
Please contact your system administrator.
Add correct host key in C:\\Users\\xxx/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in C:\\Users\\xxx/.ssh/known_hosts:1
RSA host key for 10.239.168.39 has changed and you have requested strict checking.
Host key verification failed.

 

网上查了各种方法,都不太管用

解决方法:

1.主机生成密钥对 ssh-keygen  -t rsa

2.将主机上生成的公钥.pub复制到远程机器~/.ssh/authorized_keys (没有authorized_keys就新建一个,可以通过ssh-copy-id root@remote_ip -p 22复制)

3.修改/etc/ssh/sshd_config  ->  PunlicAuthentication yes; PasswordAuthentication yes

4.重启远程机器

 

posted @ 2023-05-06 14:57  腹肌猿  阅读(80)  评论(0编辑  收藏  举报