ubuntu – 如何建立ssh密钥对时,“主机密钥验证失败”

前端之家收集整理的这篇文章主要介绍了ubuntu – 如何建立ssh密钥对时,“主机密钥验证失败”前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在我的桌面和两个服务器之间,以及从服务器到我的桌面设置了ssh密钥对,但是在我的桌面上重新安装操作系统后,我无法通过以下方式重新建立进入我的桌面的密钥对:
mkdir ~/.ssh
chmod 700 ~/.ssh
ssh-keygen -t 
ssh-copy-id username@server

我得到以下错误

(名称以斜体更改为保护无辜我的桌面是Ubuntu的,我找不到答案 here)

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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
ab:cd:ef:gh
Please contact your system administrator.
Add correct host key in /home/user/.ssh/known_hosts to get
rid of this message.
Offending key in /home/user/.ssh/known_hosts:1
RSA host key for user.server has changed and you have requested strict
checking.
Host key verification Failed.

ssh-keygen -R hostname

这将从known_hosts中删除违规键

手册页条目如下:

-R hostname Removes all keys belonging to hostname from a known_hosts file. This option is useful to delete hashed hosts (see the -H option above).

猜你在找的Ubuntu相关文章