简体   繁体   English

当 gcp vm 实例中的 ssh 时,现有主机密钥发现错误

[英]Existing host keys found error when ssh in gcp vm instance

When running gcloud beta compute ssh --zone xxx --internal-ip --project xxx xxx当运行gcloud beta compute ssh --zone xxx --internal-ip --project xxx xxx

I am getting the following error but some of my colleagues work just fine and ssh in without any issue.我收到以下错误,但我的一些同事工作得很好,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].

May I ask what can be the reason causing this and what can I do to resolve the problem?请问这可能是什么原因造成的,我能做些什么来解决这个问题?

This means that a host with the same IP address but with a different fingerprint was found in the known hosts file.这意味着在已知主机文件中找到了具有相同 IP 地址但具有不同指纹的主机。 This can happen when you create and delete instances and the same external public IP address is used for the VM instance.当您创建和删除实例并且同一外部公共 IP 地址用于 VM 实例时,可能会发生这种情况。 The fingerprint will be different for the new host (VM instance).新主机(VM 实例)的指纹会有所不同。

Edit the file /Users/xxx/.ssh/google_compute_known_hosts , find the entry for the VM's IP address and remove the entry.编辑文件/Users/xxx/.ssh/google_compute_known_hosts ,找到 VM 的 IP 地址条目并删除该条目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM