Score:1

Cannot login to Google Cloud Virtual Machine with IAM and two factor through SSH

cn flag

After I have created a Virtual Machine that runs latest Ubuntu LTS I want to connect to it using SSH.

When I login to it I get this screen:

enter image description here

I get a new code from g.co/sc

enter image description here

When I enter that code into the SSH-in-browser the same screen appears again.

What am I doing wrong?

1) Setup of Virtual Machine

Machine Configuration

  • Type: E2 Standard 4 (4 vCPU, 16 GB RAM)
  • Display Device: Enable

Boot disk

  • OS: Ubuntu LTS x86/64

Identity and API access

  • Firewall: Allow HTTPS traffic

Security

  • Shielded VM: Turn on Secure Boot

VM Access

  • Control VM access through IAM permissions
  • Require 2-Step Verification

Custom metadata

  • enable-oslogin: true
  • enable-oslogin-2fa: true

2) Permissions for vm

I have added myself to the following permissions:

  • Compute Admin
  • Compute Instance Admin
  • Compute OS Admin Login
  • Compute OS Login
  • Compute Viewer
  • Owner
Veera Nagireddy avatar
nl flag
Suggest to disable the **IP check**. Under the security codes section, there is a check box **"Allow security codes with remote access"**, by following the below steps in the Admin console: **In the Admin console, go to Menu and then [Security] then [Authentication and then2-step verification]**, Under the security codes section, there is a check box **Allow security codes with remote access**.
Veera Nagireddy avatar
nl flag
Have you tried the above comment and it helped you to resolve your issue?
Europa avatar
cn flag
This worked. Thank you.
Veera Nagireddy avatar
nl flag
Glad to hear that. The same provided as an answer. Feel free to Accept and upvote the answer for better community visibility.
Score:2
nl flag

To resolve your issue, disable the IP check. Under the security codes section, there is a check box Allow security codes with remote access, you can do by following the below steps in the Admin console: In the Admin console, go to Menu and then [Security] then [Authentication and then2-step verification], Under the security codes section, there is a check box Allow security codes with remote access.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.