Skip to content

Commit

Permalink
服务器host key变化导致连接失败
Browse files Browse the repository at this point in the history
  • Loading branch information
Juzi committed Apr 2, 2024
1 parent eb184ab commit 0f7e46a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions _posts/Development/Server/2018-03-23-generate_ssh_key.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ Enter file in which to save the key (/c/Users/user/.ssh/id_ed25519):
文件会出现在第3步中指定的位置,xxx.pub为公钥,存放在服务器上;xxx为私钥,存放在自己电脑上,可以连接有对应公钥的服务器。

> 参考:<https://docs.github.com/zh/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent>
> 参考:<https://docs.gitlab.com/ee/user/ssh.html#generate-an-ssh-key-pair>
28 changes: 28 additions & 0 deletions _posts/Development/Server/2020-05-28-ssh_key_login_server.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,34 @@ AuthorizedKeysFile .ssh/authorized_keys

<https://www.freebsd.org/cgi/man.cgi?sshd_config(5)>

### 服务器host key变化导致连接失败
若服务器重装了系统,或者有硬件变化,则可能会导致host key变化,此时客户端通过ssh连接时会出现如下报错:
```
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: POSSIBLE DNS SPOOFING DETECTED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The RSA host key for [xxx.com]:57522 has changed,
and the key for the corresponding IP address [172.26.101.72]:57522
is unknown. This could either mean that
DNS SPOOFING is happening or the IP address for the host
and its host key have changed at the same time.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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 RSA key sent by the remote host is
SHA256:du3fKBQRb+udLRzrYt3tVISqL9reYPC2jd4F6klP9Tc.
Please contact your system administrator.
Add correct host key in C:\\Users\\xxx/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in C:\\Users\\xxx/.ssh/known_hosts:2
RSA host key for [xxx.com]:57522 has changed and you have requested strict checking.
Host key verification failed.
```
解决方法:去.ssh/known_hosts下删除服务器对应的host key或者执行如下命令:
`ssh-keygen -R [xxx.com]:57522`

## 连接GitHub
1. 登录[GitHub](https://github.com/)
2. 点右上角的头像,选择`Settings`
Expand Down

0 comments on commit 0f7e46a

Please sign in to comment.