Unable to login GCP Virtual Machine (Reason: failed to connect to backend)

3.3k views Asked by At

My GPC Linux VM is working fine and one day naturally can't log in, even though it is still running, I used the nomachine to login and got error "authentication failed, please try again."

when SSH:

Connection via Cloud Identity-Aware Proxy Failed
Code: 4003
Reason: failed to connect to backend
You may be able to connect without using the Cloud Identity-Aware Proxy.

I also try add:

#! /bin/bash 

useradd -G sudo USERNAME 

echo 'USERNAME:PASSWORD' | chpasswd

and

route add default gw <gateway ip> eth0

I created another virtual machine and its image, but after a day I couldn't connect

1

There are 1 answers

1
Vishal K On

Ensure you have a firewall rule to allow Cloud Identity-Aware Proxy (IAP) to connect to port 22 on the instance. Full instructions can be found at [1].

[1] https://cloud.google.com/iap/docs/using-tcp-forwarding?authuser=0#create-firewall-rule

Cause:

When an instance does not have a public IP address, SSH in a Browser needs to forward the SSH connection through IAP. The error "failed to connect to backend" indicates that the IAP proxy service was unable to open a TCP connection to the instance.

This is most often due to the VPC firewall not having a rule which allows the proxy to connect to the instance. It coulld also be due to the OS firewall or other VM network connectivity issue.