首页 文章

通过Mac OS X终端SSH到Google Compute Engine实例

提问于
浏览
1

我在Google Compute Engine上创建了一个实例,但我似乎无法使用终端进行SSH . 我使用的命令是:

gcloud compute ssh example-instance

我得到的错误是:

ERROR: (gcloud.compute.ssh) Could not SSH to the instance.  It is possible that your SSH key has not propagated to the instance yet. Try running this command again.  If you still cannot connect, verify that the firewall and instance are set to accept ssh traffic.

当我用Google搜索错误时,我被引导到这个链接:Unable to SSH to Google Cloud

我去了检查防火墙规则https://cloud.google.com/compute/docs/troubleshooting#ssherrors,事情看起来很好 . 我也去了〜/ .ssh并检查了google_compute_engine和google_compute_engine.pub,它们表明我的私钥和公钥存在 . 我想知道下一步该做什么?这是Mac工作站特有的问题吗?

任何帮助将非常感激 .

2 回答

  • 0

    就个人而言,通过遵循Google Cloud Engine文档来正确设置我的ssh密钥存在一些问题 . 找到了另一种逻辑解

    这没用多久就解决了问题(即通过MacOS终端轻松访问Google Cloud VM)...

    请遵循nixCraft提供的这些简单说明:https://www.cyberciti.biz/faq/google-cloud-compute-engin-ssh-into-an-instance-from-linux-unix-appleosx/

  • 1

    以下是其他一些要检查的内容:

    • 可以使用Cloud Console中的"SSH"按钮从浏览器ssh到该实例吗?

    • 如果没有,请使用默认设置尝试新创建的实例,并比较 example-instance 的差异 .

    • 运行 gcloud config list 并确认项目,帐户,区域和区域的值符合您的预期 .

相关问题