“主机密钥验证失败"时如何建立ssh密钥对 [英] How to establish ssh key pair when "Host key verification failed"

查看:51
本文介绍了“主机密钥验证失败"时如何建立ssh密钥对的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在我的桌面和两台服务器之间以及从服务器到我的桌面设置了 ssh 密钥对,但是在我的桌面上重新安装操作系统后,我无法通过以下方式重新建立进入我的桌面的密钥对这个:

I have set up ssh key pairs between my desktop and two servers, and from the servers to my desktop, but after reinstalling the OS on my desktop, I can't re-establish the key-pair going into my desktop by this:

mkdir ~/.ssh
chmod 700 ~/.ssh
ssh-keygen -t 
ssh-copy-id username@server

我收到以下错误:

(斜体中的名称已更改以保护无辜者我的桌面是Ubuntu,我找不到答案 这里)

(names in italics changed to protect the innocent My desktop is Ubuntu, and I can't find the answer here)

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@警告:远程主机标识已更改!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@可能有人在做一些讨厌的事情!有人现在可能正在窃听你(中间人攻击)!也有可能 RSA 主机密钥刚刚更改.远程主机发送的 RSA 密钥的指纹是ab:cd:ef:gh请联系您的系统管理员.在/home/user/.ssh/known_hosts 中添加正确的主机密钥以获取摆脱这个消息./home/user/.ssh/known_hosts:1 中的违规键user.server 的 RSA 主机密钥已更改,您已请求严格检查.主机密钥验证失败.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ 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 从 known_hosts 文件中删除属于 hostname 的所有键.此选项对于删除散列主机很有用(请参阅 -H 选项以上).

-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).

这篇关于“主机密钥验证失败"时如何建立ssh密钥对的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆