A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://cloud.google.com/compute/docs/instances/managing-instance-access below:

Set up OS Login | Compute Engine Documentation

Set up OS Login

Stay organized with collections Save and categorize content based on your preferences.

This document describes how to set up OS Login and OS Login with two-factor authentication (2FA).

OS Login enables you to control access to virtual machine (VM) instances based on IAM permissions. You can use OS Login with or without 2FA, but you can't use 2FA without using OS Login. To learn more about OS Login and OS Login 2FA, including which challenge types OS Login supports, see About OS Login.

Before you begin Limitations

OS Login is not supported on the following VMs:

Assign OS Login IAM roles

Assign all of the required IAM roles to users who connect to VMs that have OS Login enabled.

Enable OS Login

You can enable OS Login or OS Login with two-factor authentication for a single VM, or all VMs in a project, by setting OS Login metadata.

When you set OS Login metadata, Compute Engine deletes the VM's authorized_keys files and no longer accepts connections from SSH keys that are stored in project or instance metadata.

Note: When OS Login 2FA is enabled on your VM, you must have 2-step verification set up on your Google Account or domain to connect. Otherwise, any attempts to access these VMs are denied. 2-step verification is not enforced on service account users. Enable OS Login for all VMs in a project

To enable OS Login for all VMs in a project, set the following values in project metadata:

  1. Enable OS Login:
  2. (Optional) Enable two-factor authentication:
Enable OS Login for a single VM

To enable OS Login for a single VM, set the following values in instance metadata:

  1. Enable OS Login:
  2. (Optional) Enable two-factor authentication:
Enable OS Login during VM creation

Enable OS Login (optionally, with 2-step verification) while creating a VM using the Google Cloud console or the gcloud CLI.

Console

Create a VM that enable OS Login and (optionally) OS Login 2FA on startup by creating a VM from a public image and specifying the following configurations:

  1. Expand the Advanced options section.
  2. Expand the Security section.
  3. Expand the Manage access section.
  4. Select Control VM access through IAM permissions.
  5. Optional: If you want to enable OS Login 2FA, select Require two-step verification.
  6. Click Create to create and start the VM.
gcloud
  1. In the Google Cloud console, activate Cloud Shell.

    Activate Cloud Shell

    At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.

  2. Create a VM that enable OS Login and (optionally) OS Login 2FA on startup by running one of the following gcloud compute instance create commands:

    Replace the following:

Terraform

You can apply the metadata values to your projects or VMs by using one of the following options:

Connect to VMs that have OS Login enabled

Connect to VMs that have OS Login enabled by using the methods described in Connect to Linux VMs.

When you connect to VMs that have OS Login enabled, Compute Engine uses the username that your organization administrator configured for you. If your organization administrator hasn't configured a username for you, Compute Engine generates a username in the format of USERNAME_DOMAIN_SUFFIX. For more information about usernames, see How OS Login works.

When you connect to VMs that have OS Login 2FA enabled, you also see a message based on your selected 2-step verification method or challenge type. For the phone prompt method, accept the prompts on your phone or tablet to continue. For other methods, enter your security code or one-time password.

Troubleshoot OS Login

To find methods for diagnosing and resolving OS Login errors, see Troubleshooting OS Login.

What's next

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-08-07 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["OS Login lets you manage VM access using IAM permissions, and it can be used with or without two-factor authentication (2FA), although 2FA requires OS Login."],["To use OS Login or OS Login with 2FA, you can enable it for all VMs in a project or for individual VMs by setting the appropriate metadata keys (`enable-oslogin` and `enable-oslogin-2fa`)."],["OS Login is not supported on Windows Server, SQL Server VMs, or Fedora CoreOS VMs, and using OS Login will result in the deletion of a VM's `authorized_keys` files, preventing SSH key connections via project or instance metadata."],["When connecting to VMs with OS Login enabled, Compute Engine uses a configured username or generates one in the format of `USERNAME_DOMAIN_SUFFIX`, and OS Login 2FA enforces 2-step verification for access."],["To set up the correct authentication, use the console, gcloud, or terraform options depending on your needs, in addition to properly granting the required IAM roles to users that will connect to the VM."]]],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4