Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google cloud platform 无法登录到GCP VM计算机:kex_exchange_标识:连接已被远程主机关闭_Google Cloud Platform_Virtual Machine_Google Compute Engine - Fatal编程技术网

Google cloud platform 无法登录到GCP VM计算机:kex_exchange_标识:连接已被远程主机关闭

Google cloud platform 无法登录到GCP VM计算机:kex_exchange_标识:连接已被远程主机关闭,google-cloud-platform,virtual-machine,google-compute-engine,Google Cloud Platform,Virtual Machine,Google Compute Engine,我正在尝试登录到VM计算机,但无法进入,因为弹出以下错误: ERROR: (gcloud.beta.compute.start-iap-tunnel) Error while connecting [[Errno 1] Operation not permitted]. kex_exchange_identification: Connection closed by remote host ERROR: (gcloud.beta.compute.ssh) [/usr/bin/ssh] exit

我正在尝试登录到VM计算机,但无法进入,因为弹出以下错误:

ERROR: (gcloud.beta.compute.start-iap-tunnel) Error while connecting [[Errno 1] Operation not permitted].
kex_exchange_identification: Connection closed by remote host
ERROR: (gcloud.beta.compute.ssh) [/usr/bin/ssh] exited with return code [255].
用于登录的命令:

gcloud beta compute ssh --zone "us-east1-b" "user1@test"  --project "my-test-project"
当我使用来自不同机器的相同命令时,它允许我登录到测试VM


我一直在寻找与防火墙设置相关的可能解决方案,但未能取得成功。这里有人能帮忙吗?

我尝试使用您发布的命令连接实例,当我从cloud shell和其他实例使用它时,您为我工作。提供给您的错误可能由于不同的原因发生,这些原因包括:

  • 虚拟机正在启动,sshd尚未运行。在VM运行之前,您无法连接到它。 要解决此问题,请等待VM完成引导,然后再次尝试连接

  • 允许SSH的防火墙规则缺失或配置错误。默认情况下,计算引擎VM允许在端口22上进行SSH访问。如果默认的allow ssh规则丢失或配置错误,您将无法连接到虚拟机。 要解决此问题,请检查并重新添加或重新配置默认的allow ssh

  • sshd正在自定义端口上运行。如果将sshd配置为在端口22以外的端口上运行,则无法连接到VM。要解决此问题,请使用以下命令创建一个自定义防火墙规则,允许在运行sshd的端口上进行tcp通信:

    gcloud compute firewall-rules create FIREWALL_NAME --allow tcp:PORT_NUMBER
    
  • 您的自定义SSH防火墙规则不允许来自Google服务的流量。如果自定义防火墙规则不允许来自谷歌IP地址范围的连接,则来自云控制台的SSH连接将被拒绝。 要解决此问题,请访问

  • sshd守护进程未运行或配置不正确。sshd守护进程启用SSH连接。如果配置错误或未运行,则无法连接到虚拟机。要解决此问题,请查看操作系统的用户指南,以确保正确设置了