Ubuntu / Debian Linux:重新生成SSH fingerprint keys

作者: lesca 分类: Tutorials,Ubuntu 发布时间: 2012-03-01 10:58

重新生成SSH fingerprint keys

1.删除原有的host key

# rm /etc/ssh/ssh_host*

2.重新配置SSH服务器

# dpkg-reconfigure openssh-server

之后可能会有如下输出:

Creating SSH2 RSA key; this may take some time ...
Creating SSH2 DSA key; this may take some time ...
Restarting OpenBSD Secure Shell server: sshd.

3.更新known_hosts文件

你需要手动更新~/.ssh/known_hosts 文件,或者删除它,否则其他主机连接时就会出现如下警告:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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
f6:67:01:41:e6:20:06:4b:4b:fa:4b:c1:f1:45:45:e0.
Please contact your system administrator.
Add correct host key in /home/vivek/.ssh/known_hosts to get rid of this message.
Offending key in /home/vivek/.ssh/known_hosts:12
RSA host key for 202.54.xx.abc has changed and you have requested strict checking.
Host key verification failed.

Reference:

[1] Ubuntu / Debian Linux Regenerate OpenSSH Host Keys

版权声明

本文出自 Lesca 技术宅,转载时请注明出处及相应链接。

本文永久链接: https://www.lesca.cn/archives/ubuntu-debian-linux-regenerate-fingerprint-keys.html

如果觉得我的文章对您有用,请随意赞赏。您的支持将鼓励我继续创作!