Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Auf dieser Seite werden der OS Login-Dienst und seine Funktionsweise beschrieben. Informationen zum Einrichten von OS Login finden Sie unter OS Login einrichten.
Mit OS Login können Sie den SSH-Zugriff auf Ihre Instanzen mithilfe von IAM verwalten, ohne einzelne SSH-Schlüssel erstellen und verwalten zu müssen. OS Login verwendet eine konsistente Linux-Nutzeridentität über VM-Instanzen hinweg und wird empfohlen, wenn viele Nutzer über mehrere VMs oder Projekte hinweg verwaltet werden müssen.
Vorteile von OS Login
OS Login vereinfacht die Verwaltung des SSH-Zugriffs, weil Ihr Linux-Nutzerkonto mit Ihrer Google-Identität verknüpft wird. Administratoren können den Zugriff auf Instanzen auf Instanz- oder Projektebene einfach dadurch verwalten, dass sie IAM-Berechtigungen festlegen.
OS Login bietet folgende Vorteile:
Automatisches Lebenszyklusmanagement für Linux-Konten: Sie können ein Linux-Nutzerkonto direkt an die Google-Identität eines Nutzers binden. Dadurch werden für alle Instanzen in demselben Projekt oder in derselben Organisation die gleichen Linux-Kontodaten verwendet.
Detailgenaue Autorisierung mit Google IAM: Administratoren auf Projekt- und Instanzebene können der Google-Identität eines Nutzers mit IAM SSH-Zugriff gewähren, ohne dass umfassendere Berechtigungen erteilt werden. Beispielsweise können Sie einem Nutzer Berechtigungen zur Anmeldung im System erteilen, ohne ihm dabei die Möglichkeit zu bieten, Befehle wie sudo auszuführen. Google prüft diese Berechtigungen, um festzustellen, ob sich ein Nutzer bei einer VM-Instanz anmelden kann.
Automatische Aktualisierungen von Berechtigungen: Bei OS Login werden Berechtigungen automatisch aktualisiert, wenn ein Administrator die IAM-Berechtigungen ändert. Wenn Sie beispielsweise einer Google-Identität IAM-Berechtigungen entziehen, wird der Zugriff auf VM-Instanzen gesperrt. Google prüft bei jedem Anmeldeversuch die Berechtigungen, um unerwünschten Zugriff zu verhindern.
Importmöglichkeit für vorhandene Linux-Konten: Administratoren können optional Linux-Kontodaten aus Active Directory (AD) und LDAP (Lightweight Directory Access Protocol), die lokal eingerichtet sind, synchronisieren. So können Sie beispielsweise dafür sorgen, dass Nutzer sowohl in Ihrer Cloud als auch in lokalen Umgebungen dieselbe Nutzer-ID (UID) haben.
Integration mit Bestätigung in zwei Schritten des Google-Kontos: Sie können optional festlegen, dass OS Login-Nutzer ihre Identität mithilfe einer der folgenden zweistufigen Bestätigungsmethoden (2FA) oder Identitätsbestätigungen validieren, wenn sie eine Verbindung zu VMs herstellen:
Unterstützung der zertifikatbasierten Authentifizierung (Vorabversion): Sie können die SSH-Zertifikatauthentifizierung verwenden, um eine Verbindung zu VMs herzustellen, die OS Login verwenden. Weitere Informationen finden Sie unter SSH-Zertifikate mit OS Login erforderlich machen.
Integration mit Audit-Logging: OS Login bietet Audit-Logging, mit dem Sie Verbindungen zu VMs für OS Login-Nutzer überwachen können.
So funktioniert OS Login
Wenn OS Login aktiviert ist, führt Compute Engine Konfigurationen auf VMs und den Google-Konten von OS Login-Nutzern aus.
VM-Konfiguration
Wenn Sie OS Login aktivieren, löscht Compute Engine die authorized_keys-Dateien der VM und konfiguriert einen OpenSSH-Server. Dieser Server ruft die SSH-Schlüssel ab, die dem Linux-Nutzerkonto zugeordnet sind, und authentifiziert damit den Anmeldeversuch.
Sie können eine authorized_keys-Datei konfigurieren, um Zugriff für ein lokales Nutzerkonto bereitzustellen, auch wenn OS Login aktiviert ist. Öffentliche SSH-Schlüssel, die in der Datei authorized_keys konfiguriert sind, werden verwendet, um Nutzeranmeldungsversuche vom lokalen Nutzer zu authentifizieren. Lokale Nutzerkonten und OS Login-Nutzer müssen unterschiedliche Nutzernamen und UIDs haben.
OS Login konfiguriert Ihr Google-Konto mit POSIX-Informationen, einschließlich eines Nutzernamens, wenn eine der folgenden Aktionen ausgeführt wird:
Verbindung zu einer OS Login-VM mit der Google Cloud Konsole herstellen
Verbindung zu einer OS Login-VM über die gcloud CLI herstellen
Öffentlichen SSH-Schlüssel mithilfe der gcloud CL importieren
Öffentlichen SSH-Schlüssel mit der OS Login API importieren
OS Login konfiguriert POSIX-Konten mit folgenden Werten:
Nutzername: Ein Nutzername im Format USERNAME_DOMAIN_SUFFIX.
Wenn der Nutzer aus einer anderen Google Workspace-Organisation stammt als der, die seine OS Login-fähigen VMs hostet, wird seinem Nutzernamen das Präfix ext_ vorangestellt. Wenn der Nutzer ein Dienstkonto ist, wird seinem Nutzernamen das Präfix sa_ vorangestellt.
GID: Eine POSIX-konforme Gruppen-ID, die der UID entspricht.
Basisverzeichnis: Der Pfad zum Basisverzeichnis des Nutzers.
Organisationsadministratoren können die POSIX-Kontoinformationen eines Nutzers konfigurieren und aktualisieren. Weitere Informationen finden Sie unter Nutzerkonten mithilfe der Directory API bearbeiten.
Nächste Schritte
Schritt-für-Schritt-Anleitungen erhalten Sie in einem der folgenden Abschnitte:
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-03 (UTC)."],[[["\u003cp\u003eOS Login streamlines SSH access management by linking Linux user accounts to Google identities, eliminating the need for individual SSH key management.\u003c/p\u003e\n"],["\u003cp\u003eIt leverages Google IAM for fine-grained authorization, enabling administrators to control access at the instance or project level and grant specific permissions, such as login without \u003ccode\u003esudo\u003c/code\u003e rights.\u003c/p\u003e\n"],["\u003cp\u003eOS Login automates Linux account lifecycle management, ensuring consistent user information across VMs, and automatically updates permissions based on changes in IAM settings.\u003c/p\u003e\n"],["\u003cp\u003eThe system supports integration with two-step verification methods and provides audit logging for monitoring VM connections.\u003c/p\u003e\n"],["\u003cp\u003eWhen OS Login is enabled, it configures VMs by managing \u003ccode\u003eauthorized_keys\u003c/code\u003e files, setting up an OpenSSH server with \u003ccode\u003eAuthorizedKeysCommand\u003c/code\u003e, configuring NSS functionality, and adding PAM configurations.\u003c/p\u003e\n"]]],[],null,["*** ** * ** ***\n\nThis page describes the OS Login service and how it works. To learn how to set\nup OS Login, see [Set up OS Login](/compute/docs/oslogin/set-up-oslogin).\n\nUse OS Login to manage SSH access to your instances using IAM\nwithout having to create and manage individual SSH keys. OS Login maintains a\nconsistent Linux user identity across VM instances and is the recommended way to\nmanage many users across multiple VMs or projects.\n| **Note:** When a user connects to a VM, that user can use all of the IAM permissions granted to the service account attached to the VM.\n\nBenefits of OS Login\n\nOS Login simplifies SSH access management by linking your Linux user account to\nyour Google identity. Administrators can easily manage access to instances at\neither an instance or project level by setting IAM permissions.\n\nOS Login provides the following benefits:\n\n- **Automatic Linux account lifecycle management** - You can directly tie\n a Linux user account to a user's Google identity so that the same Linux\n account information is used across all instances in the same project or\n organization.\n\n- **Fine grained authorization using Google IAM** - Project\n and instance-level administrators can use IAM to grant SSH\n access to a user's Google identity without granting a broader set of\n privileges. For example, you can grant a user permissions to log into the\n system, but not the ability to run commands such as `sudo`. Google checks\n these permissions to determine whether a user can log into a VM instance.\n\n- **Automatic permission updates** - With OS Login, permissions are updated\n automatically when an administrator changes IAM\n permissions. For example, if you remove IAM permissions from\n a Google identity, then access to VM instances is revoked. Google checks\n permissions for every login attempt to prevent unwanted access.\n\n- **Ability to import existing Linux accounts** - Administrators\n can choose to optionally synchronize Linux account information from\n Active Directory (AD) and Lightweight Directory Access Protocol (LDAP) that\n are set up on-premises. For example, you can ensure that users have the\n same user ID (UID) in both your Cloud and on-premises environments.\n\n- **Integration with Google Account two-step verification** - You can optionally\n require that OS Login users validate their identity using one of the following\n 2-step verification (2FA) methods or challenge types when connecting to VMs:\n\n - [Google Authenticator](https://support.google.com/accounts/answer/1066447)\n - Text message or phone call verification\n - [Phone prompts](https://support.google.com/accounts/answer/7026266)\n - [Security key one-time password (OTP)](https://gsuiteupdates.googleblog.com/2019/06/security-codes-and-security-keys.html)\n- **Support for certificate-based authentication (Preview)** - You can use SSH\n certificate authentication to connect to VMs that use OS Login. For more\n information, see\n [Require SSH certificates with OS Login](/compute/docs/oslogin/certificates).\n\n- **Integration with audit logging** - OS Login provides\n [audit logging](/compute/docs/oslogin/view-audit-logs) that you can use to\n monitor connections to VMs for OS Login users.\n\nHow OS Login works\n\nWhen OS Login is enabled, Compute Engine performs configurations\non VMs and the Google accounts of OS Login users.\n\nVM configuration\n\nWhen you enable OS Login, Compute Engine deletes the VM's `authorized_keys`\nfiles and configures an OpenSSH server. This server retrieves the SSH keys\nassociated with the Linux user account to authenticate the login attempt.\n\nYou can configure an `authorized_keys` file to provision access for a local user\naccount even when OS Login is enabled. SSH public keys that are configured in\nthe `authorized_keys` file are used to authenticate user login attempts by the\nlocal user. Local user accounts and OS Login users must have different usernames\nand UIDs.\n| **Note:** VMs that use OS Login can't use metadata-based SSH keys. If you enable OS Login for a VM, then the VM's guest agent ignores the keys stored in metadata. To learn more about using SSH keys with VMs, see [Add SSH keys to VMs](/compute/docs/connect/add-ssh-keys).\n\nFor more information about the OS Login components, review the\n[OS Login GitHub page](https://github.com/GoogleCloudPlatform/guest-oslogin#overview).\n\nUser account configuration\n\nOS Login configures your Google account with POSIX information, including a\nusername, when you do any of the following:\n\n- Connect to an OS Login-enabled VM using the Google Cloud console\n- Connect to an OS Login-enabled VM using the gcloud CLI\n- Import a public SSH key using the gcloud CLI\n- Import a public SSH key using the OS Login API\n\nOS Login configures POSIX accounts with the following values:\n\n- **Username:** a username in the format of\n \u003cvar translate=\"no\"\u003eUSERNAME\u003c/var\u003e`_`\u003cvar translate=\"no\"\u003eDOMAIN\u003c/var\u003e`_`\u003cvar translate=\"no\"\u003eSUFFIX\u003c/var\u003e.\n If the user is from a different Google Workspace organization than the\n one hosting their OS Login-enabled VMs, their username is prefixed\n with `ext_`. If the user is a service account, its username is prefixed with\n `sa_`.\n\n Cloud Identity administrators can\n [modify usernames](/compute/docs/oslogin/manage-oslogin-in-an-org#modify-users)\n and Google Workspace super administrators can change the username\n format to\n [remove the domain suffix](/compute/docs/oslogin/manage-oslogin-in-an-org#manage-oslogin-api).\n- **UID:** a unique, randomly-generated\n [POSIX-compliant](https://en.wikipedia.org/wiki/User_identifier) user ID.\n\n- **GID:** a POSIX-compliant group ID that is the same as the UID.\n\n- **Home directory:** the path to the user's home directory.\n\nOrganization administrators can configure and update a user's POSIX account\ninformation. For more information, see\n[Modify user accounts using the Directory API](/compute/docs/oslogin/manage-oslogin-in-an-org#modify-users).\n\nWhat's next\n\n- For step-by-step instructions, review one of the following:\n - [Setting up OS Login](/compute/docs/instances/managing-instance-access).\n - [Setting up OS Login with 2-step verification](/compute/docs/oslogin/setup-two-factor-authentication)\n- Review [Managing OS Login in an organization](/compute/docs/oslogin/manage-oslogin-in-an-org)\n- [Troubleshoot](/compute/docs/oslogin/troubleshoot-os-login) OS Login."]]