Google计算引擎ssh不可用

时间:2015-08-14 07:34:58

标签: ssh google-compute-engine

我已经重新启动了我们的Google云计算引擎实例,但是在重新启动后ssh不再有效并且提供connection refused

我已经验证并且为用户配置了ssh密钥,并且为ssh打开了防火墙规则。

我可以使用其他任何方法来尝试解决此问题吗?

2 个答案:

答案 0 :(得分:2)

首先要检查机器的串行控制台输出,以确定SSH守护程序是否已启动。可以从Developer Console访问该日志。

答案 1 :(得分:0)

如果无法SSH到实例,则可以按照以下步骤从串行控制台访问实例:

使用串行控制台连接到实例

1. Go to the VM instances page in Google Cloud Platform console. 
2. Click on the instance for which you want to add a startup script. 
3. Click the Edit button at the top of the page.
4. Click on ‘Enable connecting to serial ports’
5. Under Custom metadata, click Add item. 
6. Set 'Key' to 'startup-script' and set 'Value' to this script:
#! /bin/bash 
useradd -G sudo USERNAME 
echo 'USERNAME:PASSWORD' | chpasswd
7. Click Save and then click RESET on the top of the page. You might need to wait for some time for the instance to reboot. 
8. Click on 'Connect to serial port' in the page. 
9.  In the new window, you might need to wait a bit and press on Enter of your keyboard once; then, you should see the login prompt. 
10. Login using the USERNAME and PASSWORD you provided.