验证 Azure Linux VM 的 ECDSA 密钥指纹

验证 Azure Linux VM 的 ECDSA 密钥指纹

我开始在 Windows (Insider Preview build 14316) 上使用 bash,并在 Azure 中创建了一个 Linux VM。当我通过 ssh 进入它时,系统显示“无法确定主机‘##.##.##.##’的真实性。ECDSA 密钥指纹为 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx。”

我如何验证指纹属于我的新虚拟机?

编辑:澄清,尽我所能只能通过 SSH 连接到 Azure Linux VM。我仔细研究了Azure 门户指纹无济于事。我想我需要通过 SSH 以外的方式连接到虚拟机(此时我可以使用ssh-keygen)或通过门户获取指纹,但我搞不清楚如何做;我愿意尝试我忽略的其他方法。

答案1

当你本地登录到 Linux VM(即不是通过 SSH)时,你可以展示的指纹SSH 主机密钥

$ ssh-keygen -f /etc/ssh/ssh_host_ecdsa_key.pub -l
256 MD5:68:b3:29:da:98:93:e3:40:99:c7:d8:ad:5c:b9:c9:40 no comment (ECDSA)

此指纹应与您尝试通过 SSH 登录时显示的字符相匹配:

$ ssh VM
The authenticity of host 'VM (192.168.0.2)' can't be established.
ECDSA key fingerprint is 68:b3:29:da:98:93:e3:40:99:c7:d8:ad:5c:b9:c9:40.
Are you sure you want to continue connecting (yes/no)?

注意:较新的ssh-keygen版本可能需要“ -E md5”开关来打印出 MD5 指纹。

相关内容