问题描述
我刚刚使用Google Cloud Platform的Compute Engine创建了一个实例,并尝试通过SSH连接连接到该实例,但是失败了.
I've just created an instance using Google Cloud Platform's Compute Engine and tried to connect to it via SSH connection but it failed.
我正在快速入门此处.
我已经在我的PC上生成了SSH密钥,并在被询问时输入了密码.虽然我无法成功登录:-(
I have generated the SSH key on my PC and have entered the pass-phrase when asked. Though I fail to succeed a log in :-(
我得到了PuTTY SSH的错误,如下快照所示.
I got the PuTTY SSH's error as below snapshots.
然后我的PuTTY窗口处于非活动状态.
Then I get the PuTTY window inactive.
推荐答案
我遇到了同样的问题,但是找到了一种通过PuTTY手动连接的解决方法.
I have the same problem but found a workaround to connect via PuTTY manually.
- 为计算机实例生成SSH密钥
- 将SSH公钥添加到实例
- 准备登录-获取有关IP,登录名,密码,私有SSH密钥的信息
- 通过SSH客户端连接到实例,例如Windows中的PuTTY
详细步骤
对我来说,gcloud 快速启动已经:
- 启动我的实例
- 创建了我的公共和私有RSA密钥(在
C:\Users\USER_NAME\.ssh\
中)
公开密钥-C:\ Users \ USER_NAME \ .ssh \ google_compute_engine.pub
Public Key - C:\Users\USER_NAME\.ssh\google_compute_engine.pub
私钥-C:\ Users \ USER_NAME \ .ssh \ google_compute_engine.ppk
Private Key - C:\Users\USER_NAME\.ssh\google_compute_engine.ppk
- 在浏览器中转到Google Developers Console
- 选择您的项目,然后在左侧导航栏中单击:计算->计算引擎-> VM实例
- 您正在运行的实例将在CPU使用率图表下方链接
- 单击所需的链接,然后找到
Add SSH key
链接,然后单击它 - 将
google_compute_engine.pub
的全部内容粘贴到出现的字段中 - 单击保存",几秒钟后,密钥详细信息将出现在页面上(如果遇到错误,您将从错误的密钥文件中粘贴或未复制所有文本)
- 这些详细信息中的第一个单词是您的字母(区分大小写)
username
- Go to the Google Developers Console in your browser
- Select your project and in the left hand nav bar click: Compute -> Compute Engine -> VM instances
- Your running instance(s) will be linked below the CPU usage chart
- Click the one you want and find the
Add SSH key
link and click it - Paste the entire contents of
google_compute_engine.pub
into the field that appears - Click Save and after a few seconds the key details will appear on the page (if you get an error you pasted from the wrong key file or didn't copy all the text)
- The first word in those details is your (case sensitive)
username
- 在页面上找到以上
External IP
-
打开PuTTY,然后将外部IP粘贴到主机名"中(端口默认为22)
- Find the
External IP
above on the page Open PuTTY and paste the external IP into Host Name (port is the default of 22)
在左侧导航栏中,展开:连接-> SSH,然后单击身份验证
In the left hand nav expand: Connection -> SSH and then click Auth
希望这会有所帮助.如果有人对gcloud问题有解决方案,我也很想听听.
Hope this helps. If someone has a solution for the gcloud issue I'd love to hear it too.
这篇关于无法通过SSH连接到Compute Engine实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!