【问题标题】:Existing host keys found error when ssh in gcp vm instance在 gcp vm 实例中 ssh 时发现现有主机密钥错误
【发布时间】:2021-09-22 00:29:07
【问题描述】:

运行时gcloud beta compute ssh --zone xxx --internal-ip --project xxx xxx

我收到以下错误,但我的一些同事工作正常并且 ssh 没有任何问题。

Existing host keys found in /Users/xxx/.ssh/google_compute_known_hosts
ERROR: (gcloud.beta.compute.ssh) [/usr/bin/ssh] exited with return code [255].

请问这是什么原因造成的,我可以做些什么来解决这个问题?

【问题讨论】:

    标签: google-cloud-platform ssh google-compute-engine gcloud


    【解决方案1】:

    这意味着在已知主机文件中找到了具有相同 IP 地址但具有不同指纹的主机。当您创建和删除实例并且 VM 实例使用相同的外部公共 IP 地址时,可能会发生这种情况。新主机(VM 实例)的指纹会有所不同。

    编辑文件/Users/xxx/.ssh/google_compute_known_hosts,找到VM的IP地址条目并删除该条目。

    【讨论】:

    • 谢谢,John,我仔细检查了文件中没有 IP 地址,它的格式如下:compute.xxxx ssh-ed25519 xxxxxxxx compute.xxxx ssh-rsa xxxx compute.xxxxxx ecdsa -sha2-nistp256 xxxx
    • @Ken 该文件可以使用主机名或 IP 地址。在您的情况下,主机名。我的建议是删除文件,然后重新创建。
    • 感谢@John,顺便说一句,在生成过程中有时对我来说,我收到以下错误:将 3 个密钥写入 /Users/xxxx/.ssh/google_compute_known_hosts 错误:(gcloud.beta.compute.ssh) [/usr/bin/ssh] 退出并返回代码 [255]。你知道为什么会这样吗?
    • @Ken - 我需要更多细节。在“已知主机”的上下文中,三个键没有意义,除非措辞是“主机键”。
    猜你喜欢
    • 1970-01-01
    • 2020-12-21
    • 2020-04-10
    • 1970-01-01
    • 1970-01-01
    • 2016-12-03
    • 2019-10-16
    • 2015-01-11
    • 1970-01-01
    相关资源
    最近更新 更多