我克隆了一个服务器,因此它们具有相同的 RSA 密钥指纹。
它似乎在/etc/ssh/ssh_host_rsa_key.pub.
改变它的正确方法是什么?
谢谢。
我有一个 PEM 文件,我将它添加到正在运行的 ssh-agent 中:
$ file query.pem
query.pem: PEM RSA private key
$ ssh-add ./query.pem
Identity added: ./query.pem (./query.pem)
$ ssh-add -l | grep query
2048 ef:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX ./query.pem (RSA)
Run Code Online (Sandbox Code Playgroud)
如何直接从文件中获取密钥的指纹(我在 ssh-agent 中看到的)?我知道ssh-keygen -l -f some_key适用于“普通”ssh 密钥,但不适用于 PEM 文件。
如果我在 .pem 文件上尝试 ssh-keygen,我会得到:
$ ssh-keygen -l -f ./query.pem
key_read: uudecode PRIVATE KEY----- failed
key_read: uudecode PRIVATE KEY----- failed
./query.pem is not a public key file.
Run Code Online (Sandbox Code Playgroud)
这个键开始于:
-----BEGIN RSA PRIVATE KEY-----
MIIEp.... etc.
Run Code Online (Sandbox Code Playgroud)
与“常规”私钥相反,它看起来像:
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: …Run Code Online (Sandbox Code Playgroud) 我有一些经常更改 IP 的云盒。
我使用主机名 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…
Run Code Online (Sandbox Code Playgroud)
除了任何安全风险以及与我想做的事情相关的风险之外,有没有办法忽略此错误或自动覆盖 known_hosts 文件,以便我不必总是自己编辑它?
尝试ssh进入服务器时,我收到了众所周知的警告消息:
$ ssh whateverhost
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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 ECDSA key sent by the remote host is
SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxx/xxxxxxxxx/xxxxxxx.
Please contact your system administrator.
Add correct host key in /home/user/.ssh/known_hosts to get rid of this message.
Offending ECDSA key …Run Code Online (Sandbox Code Playgroud)