Google 云:我无法访问我的虚拟机

Google cloud: I can not acces to my VM

我的 google 云虚拟机有问题 突然我无法从 google 云访问我的 VM 实例:它返回我: ssh:连接到主机端口 22:连接被拒绝

我有 运行 nmap 和输出 主人起来了 港口国服务 22/tcp 过滤 ssh

我修改了 /etc/ssh/ssh_config,以防止 broken pip 错误,添加:

ServerAliveInterval 120

ServerAliveCountMax 10

到该文件的末尾。

1.: 任何人都可以弄清楚发生了什么以及如何解决它。

  1. 有什么方法可以替代 ssh 连接到我的 VM 实例吗?

非常感谢

以上评论总结:


  1. 为实例中的用户设置密码 by setting up an startup script on the GCE instance
    • 向 GCE 实例添加启动脚本:
      • 单击实例名称。
      • 点击编辑。
      • 像这样设置自定义元数据:
        • 密钥 启动脚本
        • #!/bin/bash 回声-e "linuxpassword\nlinuxpassword" |密码 linuxuser**

If you've never set a password for either your user or root you'll be asked twice for a new password, if you've set a password before you'll be asked first for the old password and then twice for the new password, so take this in account when using the startup script. As explained here the script to set the password can be run with or without --stdin parameter depending on the system you run the script on.

  1. 通过Interactive Serial Console访问实例。

  2. 将文件 /etc/ssh/ssh_config 上的设置还原为旧配置并再次尝试 ssh。

  3. 重要说明,出于安全原因删除启动脚本更改密码 在您重新获得对实例的访问权后从实例中获取。