# 4.4 Ensure OS Login Is Enabled for a Project (Automated)

- Source: https://support.icompaas.com/support/solutions/articles/62000233018-4-4-ensure-os-login-is-enabled-for-a-project-automated-
- Section: [Solutions](https://support.icompaas.com/support/solutions) › [GCP Benchmarks](https://support.icompaas.com/support/solutions/62000112667) › [GCP Knowledge Bases](https://support.icompaas.com/support/solutions/folders/62000169178)
- Last updated: 2026-05-29
- Publisher: iCompaas, Inc. (https://www.icompaas.com)

Profile Applicability:

Level 1

Description:

OS Login binds SSH certificates to IAM users, enabling centralized and automated SSH key management, which simplifies access control and improves security.

Rationale:

Enabling OS Login ensures that SSH keys are mapped to IAM users. This setup allows for efficient SSH key management, enabling quick responses to compromised keys or revoked user access. Revoking an IAM user's access automatically invalidates all associated SSH keys. This approach enhances security by streamlining key management and eliminating metadata-based SSH key configurations.

Impact:

-   Enabling OS Login: Disables metadata-based SSH key configurations across all instances in the project.
    
-   Disabling OS Login: Restores metadata-based SSH key configurations.
    
-   Users relying on metadata-based SSH keys will need to adjust their access methods.
    

Default Value:

-   By default, enable-oslogin is not set, which is equivalent to FALSE.
    

Audit Steps:

#### From Google Cloud Console:

1.  Navigate to the VM Compute Metadata page: [https://console.cloud.google.com/compute/metadata](https://console.cloud.google.com/compute/metadata).
    

                     ![](https://support.icompaas.com/assets/kb/b2c95c97b24676a6.png)

2.  Verify that the key enable-oslogin exists with a value set to TRUE.
    

                    ![](https://support.icompaas.com/assets/kb/53737864bdec0e34.png)

3.  Ensure that no instance overrides the project setting with enable-oslogin set to FALSE.
    

#### From Google Cloud CLI:

List project instances and metadata:

gcloud compute instances list --format=json

1.  Check the commonInstanceMetadata section to verify that enable-oslogin is set to TRUE.
    

Exception:

-   Exclude VMs created by GKE (Google Kubernetes Engine), which typically have names starting with gke- and labels like goog-gke-node.
    

Remediation Steps:

#### From Google Cloud Console:

1.  Navigate to the VM Compute Metadata page: [https://console.cloud.google.com/compute/metadata](https://console.cloud.google.com/compute/metadata).
    

                     ![](https://support.icompaas.com/assets/kb/c05cb675304b08dc.png)

2.  Click Edit and add the metadata key enable-oslogin with a value of TRUE.
    

                  ![](https://support.icompaas.com/assets/kb/2c03bae98667de5b.png)

                  ![](https://support.icompaas.com/assets/kb/1da89a6da5a4364a.png)

3.  Save your changes.
    

                           ![](https://support.icompaas.com/assets/kb/23e63052e36b3444.png)

4.  For instances overriding the project setting:
    
    -   Go to the VM Instances page: [https://console.cloud.google.com/compute/instances](https://console.cloud.google.com/compute/instances).
        

              ![](https://support.icompaas.com/assets/kb/b2af57f80a4ad5a8.png)

-   Click the instance name to open its details page.
    

          ![](https://support.icompaas.com/assets/kb/c208a11b13fed9b9.png)

-   Click Edit and remove any custom metadata entry with enable-oslogin set to FALSE.
    

           ![](https://support.icompaas.com/assets/kb/f6ae4d6b64c0c594.png)

-   Save the changes.
    

                 ![](https://support.icompaas.com/assets/kb/f1aba8191e1f66dd.png)

#### From Google Cloud CLI:

Enable OS Login for the project:

gcloud compute project-info add-metadata --metadata enable-oslogin=TRUE

Remove any instance-specific metadata overriding the project setting:

gcloud compute instances remove-metadata <INSTANCE\_NAME> --keys=enable-oslogin

References:

1.  [Enable OS Login](https://cloud.google.com/compute/docs/instances/managing-instance-access#enable_oslogin)
    
2.  [Two-Factor Authentication for OS Login](https://cloud.google.com/compute/docs/oslogin/setup-two-factor-authentication)
    

Additional Information:

-   Instances using custom images must have the latest Linux Guest Environment for OS Login.
    
-   OS Login is not supported by certain image families, including:
    
    -   Container-Optimized OS (cos-stable)
        
    -   CoreOS
        
    -   SLES-11
        
    -   Windows Server and SQL Server
        

CIS Controls:

<table style="border:none;border-collapse:collapse"><colgroup style="font-family:&quot;Helvetica Neue&quot;"><col style="font-family:&quot;Helvetica Neue&quot;"><col style="font-family:&quot;Helvetica Neue&quot;"><col style="font-family:&quot;Helvetica Neue&quot;"><col style="font-family:&quot;Helvetica Neue&quot;"><col style="font-family:&quot;Helvetica Neue&quot;"></colgroup><tbody><tr style="height:41.5pt;font-family:&quot;Helvetica Neue&quot;"><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;"><p dir="ltr" style="line-height:1.38;text-align:center;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;"><span style="font-size:13px"><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-weight:700;font-family:&quot;Helvetica Neue&quot;">Control</span></span></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;"><p dir="ltr" style="line-height:1.38;text-align:center;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;"><span style="font-size:13px"><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-weight:700;font-family:&quot;Helvetica Neue&quot;">Description</span></span></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;"><p dir="ltr" style="line-height:1.38;text-align:center;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;"><span style="font-size:13px"><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-weight:700;font-family:&quot;Helvetica Neue&quot;">IG 1</span></span></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;"><p dir="ltr" style="line-height:1.38;text-align:center;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;"><span style="font-size:13px"><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-weight:700;font-family:&quot;Helvetica Neue&quot;">IG 2</span></span></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;"><p dir="ltr" style="line-height:1.38;text-align:center;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;"><span style="font-size:13px"><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-weight:700;font-family:&quot;Helvetica Neue&quot;">IG 3</span></span></span></p></td></tr><tr style="height:41.5pt;font-family:&quot;Helvetica Neue&quot;"><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;"><p dir="ltr" style="line-height:1.38;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;"><span style="font-size:13px"><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-family:&quot;Helvetica Neue&quot;">5.6 Centralize Account Management</span></span></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;"><p dir="ltr" style="line-height:1.38;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;"><strong><span style="font-size:13px"><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-weight:400;font-family:&quot;Helvetica Neue&quot;">Use a directory or identity service for centralized account management.</span></span></span></strong></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;"><p dir="ltr" style="line-height:1.38;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;"><strong><span style="font-size:13px"><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-weight:400;font-family:&quot;Helvetica Neue&quot;">✅</span></span></span></strong></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;"><p dir="ltr" style="line-height:1.38;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;"><strong><span style="font-size:13px"><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-weight:400;font-family:&quot;Helvetica Neue&quot;">✅</span></span></span></strong></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;"><strong><span style="font-size:13px"><span style="font-family:Helvetica Neue"><br style="font-family:&quot;Helvetica Neue&quot;"></span></span></strong></td></tr><tr style="height:41.5pt;font-family:&quot;Helvetica Neue&quot;"><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;"><p dir="ltr" style="line-height:1.38;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;"><span style="font-size:13px"><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-family:&quot;Helvetica Neue&quot;">6.7 Centralize Access Control</span></span></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;"><p dir="ltr" style="line-height:1.38;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;"><strong><span style="font-size:13px"><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-weight:400;font-family:&quot;Helvetica Neue&quot;">Centralize access control for all enterprise assets through a directory or SSO provider.</span></span></span></strong></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;"><p dir="ltr" style="line-height:1.38;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;"><strong><span style="font-size:13px"><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-weight:400;font-family:&quot;Helvetica Neue&quot;">✅</span></span></span></strong></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;"><p dir="ltr" style="line-height:1.38;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;"><strong><span style="font-size:13px"><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-weight:400;font-family:&quot;Helvetica Neue&quot;">✅</span></span></span></strong></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;"><strong><span style="font-size:13px"><span style="font-family:Helvetica Neue"><br style="font-family:&quot;Helvetica Neue&quot;"></span></span></strong></td></tr><tr style="height:41.5pt"><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;"><p dir="ltr" style="line-height:1.38;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;"><span style="font-size:13px"><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-family:&quot;Helvetica Neue&quot;">16.2 Centralized Authentication</span></span></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;"><p dir="ltr" style="line-height:1.38;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;"><strong><span style="font-size:13px"><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-weight:400;font-family:&quot;Helvetica Neue&quot;">Configure all accounts to use centralized authentication points.</span></span></span></strong></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;"><p dir="ltr" style="line-height:1.38;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;"><strong><span style="font-size:13px"><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-weight:400;font-family:&quot;Helvetica Neue&quot;">✅</span></span></span></strong></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;"><p dir="ltr" style="line-height:1.38;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;"><strong><span style="font-size:13px"><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-weight:400;font-family:&quot;Helvetica Neue&quot;">✅</span></span></span></strong></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word"><strong><span style="font-family:&quot;Helvetica Neue&quot;;font-size:13px"><br></span></strong></td></tr></tbody></table>

## Related compliance guidance

- [SOC 2 compliance: a practical implementation guide for cloud-native SaaS teams](https://support.icompaas.com/compliance/soc-2-trust-services-criteria): Configuration checks like this one are the technical half of a SOC 2 / ISO 27001 programme — the guide shows where they fit, what else an auditor expects, and how to evidence them.
- [ISO/IEC 27001:2022 compliance: a practical implementation guide](https://support.icompaas.com/compliance/iso-27001-2022): ISO 27001 Annex A.8 (technological controls) is where cloud hardening evidence lands; the guide shows how to run the ISMS around it.
