【问题标题】:Google compute engine ssh unavailableGoogle 计算引擎 ssh 不可用
【发布时间】:2015-08-14 07:34:57
【问题描述】:

我已经重启了我们的谷歌云计算引擎实例,但是重启后 ssh 不再工作并提供connection refused

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

有没有其他方法可以尝试解决这个问题?

【问题讨论】:

  • 你应该查阅你的服务器日志,那里写着什么或者你的客户端在详细模式下报告了什么(-vvv)
  • 您可以使用[SSH] 按钮从开发者控制台进行SSH 登录吗?有没有修改过虚拟机上的配置,比如sshd_config

标签: ssh google-compute-engine


【解决方案1】:

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

【讨论】:

    【解决方案2】:

    如果您无法通过 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.
    

    【讨论】:

      猜你喜欢
      • 2015-02-02
      • 2013-12-05
      • 1970-01-01
      • 2023-04-10
      • 1970-01-01
      • 1970-01-01
      • 2013-11-28
      • 1970-01-01
      • 2018-02-23
      相关资源
      最近更新 更多