主机密钥验证失败

use*_*351 13 ssh ubuntu host

所以我正试图通过我的电脑上的Cygwin进入我的UBUNTU.我可以毫不费力地使用WINSCP,但是当我通过命令行ssh时,它会出现这个错误:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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 ECDSA key sent by the remote host is
5d:84:de:4e:a8:81:df:22:06:23:98:34:cd:26:f5:1a.
Please contact your system administrator.
Add correct host key in /home/Trevor/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /home/DIRECTORY
ECDSA host key for HOSTNAME has changed and you have requested strict checking.
Host key verification failed.
Run Code Online (Sandbox Code Playgroud)

所以我查了一下,它说我需要更改我host key.ssh文件夹中的home文件夹.嗯,没有一个,所以我做了一个.再次尝试并得到了同样的错误.

谁能告诉我该怎么办?非常感谢先进!

小智 24

"主机密钥验证失败"表示远程主机的主机密钥已更改.

Ssh将远程主机的主机密钥存储在〜/ .ssh/known_hosts中.您可以手动编辑该文本文件并删除旧密钥(您可以在错误消息中看到行号),或使用

ssh-keygen -R hostname
Run Code Online (Sandbox Code Playgroud)


Ami*_*bey 7

尝试

 rm -f /home/user/.ssh/known_hosts
Run Code Online (Sandbox Code Playgroud)

或从已知主机删除有问题的密钥

ssh-keygen -R hostname
Run Code Online (Sandbox Code Playgroud)


Ask*_*arn 1

看起来自从您上次从 Cygwin ssh 到 ubuntu 主机密钥后,您的 ubuntu 主机密钥已更改。

消息已经告诉你该怎么做,

cd /home/Trevor.ssh 
open know_hosts file and delete the old key of your ubunto box 
once the key is removed, ssh to your ubuntu box again
Run Code Online (Sandbox Code Playgroud)