时如何建立ssh密钥对

时如何建立ssh密钥对

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

问题描述

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

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

我得到以下错误:

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


解决方案
  ssh-keygen -R hostname 

这会从 known_hosts中删除违规密钥



手册页条目如下:


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 keypair going into my desktop by this:

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

I get the following error:

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

解决方案
ssh-keygen -R hostname

This deletes the offending key from the known_hosts

The man page entry reads:

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

08-01 19:11