nerdexam
Google

PROFESSIONAL-CLOUD-NETWORK-ENGINEER · Question #61

All the instances in your project are configured with the custom metadata enable-oslogin value set to FALSE and to block project-wide SSH keys. None of the instances are set with any SSH key, and no p

The correct answer is A. Open the Cloud Shell SSH into the instance using gcloud compute ssh.. The command gcloud compute ssh (run from Cloud Shell or any authenticated environment) works by temporarily injecting your public SSH key into the instance's metadata at the instance level, then connecting. Even though project-wide SSH keys are blocked, gcloud compute ssh injects

Submitted by jakub_pl· Apr 18, 2026Implementing network security

Question

All the instances in your project are configured with the custom metadata enable-oslogin value set to FALSE and to block project-wide SSH keys. None of the instances are set with any SSH key, and no project-wide SSH keys have been configured. Firewall rules are set up to allow SSH sessions from any IP address range. You want to SSH into one instance. What should you do?

Options

  • AOpen the Cloud Shell SSH into the instance using gcloud compute ssh.
  • BSet the custom metadata enable-oslogin to TRUE, and SSH into the instance using a third-party
  • CGenerate a new SSH key pair. Verify the format of the private key and add it to the instance.
  • DGenerate a new SSH key pair. Verify the format of the public key and add it to the project.

How the community answered

(35 responses)
  • A
    83% (29)
  • B
    9% (3)
  • C
    3% (1)
  • D
    6% (2)

Explanation

The command gcloud compute ssh (run from Cloud Shell or any authenticated environment) works by temporarily injecting your public SSH key into the instance's metadata at the instance level, then connecting. Even though project-wide SSH keys are blocked, gcloud compute ssh injects keys at the instance metadata level, which is still permitted. OS Login being FALSE is fine - gcloud works with the legacy metadata-based SSH mechanism. Option C is wrong because you add the PUBLIC key to instance metadata, not the private key. Option D fails because project-wide SSH keys are explicitly blocked. Option B would work but requires changing the OS Login configuration, adding unnecessary operational steps.

Topics

#SSH Access#Instance Metadata#gcloud CLI#Authentication

Community Discussion

No community discussion yet for this question.

Full PROFESSIONAL-CLOUD-NETWORK-ENGINEER Practice