>_ SSHDock
FeaturesHow it worksBlogGuidesAbout
Launch Terminal

How to SSH into Google Cloud Compute Engine

Google Cloud Platform Compute Engine VM. Learn how to securely connect to your server from any browser without installing native terminal apps like PuTTY or Termius.

Launch SSHDock

Connection Quick Reference

  • Default Username:YOUR_GCP_USERNAME
  • Authentication:SSH Key

On this page

  • OS Login vs. Metadata SSH Keys
  • Finding Your External IP Address
  • Connecting with SSHDock
  • Troubleshooting GCP Connections

OS Login vs. Metadata SSH Keys

Google Cloud Platform (GCP) handles SSH authentication quite differently from traditional Linux distributions. By default, Compute Engine instances use either OS Login or Metadata-based SSH keys.

OS Login (The Modern Standard)

If OS Login is enabled (which is the recommended best practice for enterprise environments), GCP manages your SSH keys entirely through IAM (Identity and Access Management). In this scenario, you cannot simply append a public key to ~/.ssh/authorized_keys, because the system explicitly ignores that file.

Instead, you must add your public SSH key to your Google account or the project metadata via the gcloud CLI or the Google Cloud Console. GCP will dynamically provision a user account for you on the VM based on your Google email address (e.g., if your email is admin@example.com, your OS Login username is typically admin_example_com).

Metadata-based Keys (The Legacy Method)

If OS Login is disabled, GCP uses a custom daemon that continuously polls the instance's metadata server. If you add a public SSH key to the instance (or project) metadata, this daemon automatically creates a local Linux user account and populates their .ssh/authorized_keys file on the fly.

To use SSHDock with GCP, you must manually inject your public key into the metadata, and then connect using the username you specified when generating the key pair.

Finding Your External IP Address

Compute Engine VMs in GCP can have both internal and external IP addresses. You must use the External IP to connect via SSHDock.

  1. Navigate to the Google Cloud Console.
  2. Go to Compute Engine > VM instances.
  3. In the list of your instances, look at the External IP column.
  4. Copy this IP address. Note that unless you reserved a static external IP, this IP will change if you stop and start the instance.

Connecting with SSHDock

Since GCP doesn't hand you a .pem file on a silver platter like AWS, the easiest way to connect via SSHDock is to generate a new key pair locally (or within SSHDock), and add the public key to GCP.

Step 1: Generate or Locate Your Keys

If you don't already have an SSH key pair, you can use the standard ssh-keygen command on your local machine to generate one. The public key (e.g., id_rsa.pub) goes to Google, and the private key (e.g., id_rsa) goes into SSHDock.

Step 2: Add the Public Key to GCP Metadata

  1. In the GCP Console, click on your VM instance.
  2. Click the Edit button at the top.
  3. Scroll down to the Security and Access section and find SSH Keys.
  4. Click Add Item.
  5. Paste the entire contents of your public key. The text box will automatically extract the username from the end of the public key string (e.g., ssh-rsa AAAAB3... user@machine will extract the username user).
  6. Save the changes. GCP will immediately provision that user on the VM.

Step 3: Connect via SSHDock

  1. Open SSHDock.
  2. Enter the External IP of your GCP instance.
  3. Enter the exact Username that GCP extracted from your public key in the previous step.
  4. Select Private Key authentication.
  5. Paste your private key (the file without the .pub extension) into SSHDock.
  6. Click Connect.

Troubleshooting GCP Connections

Connection Timed Out

Google Cloud firewall rules (VPC firewall) operate independently of iptables inside the VM.

  • Go to VPC network > Firewall.
  • Ensure there is an ingress rule allowing TCP port 22 traffic from 0.0.0.0/0 (or your specific IP) targeting your instance (often managed via Network Tags like allow-ssh).

Permission Denied (publickey)

If you get a permission denied error, the GCP metadata daemon likely rejected your key or hasn't processed it yet.

  • Ensure you are using the exact username that is tied to the key in the metadata.
  • Check if OS Login is enabled. If it is, metadata keys will be ignored, and you must use the gcloud compute os-login ssh-keys add command to upload your key instead.

Explore Other Integrations

AWS EC2DigitalOcean DropletMicrosoft Azure Virtual MachineLinode Compute InstanceVultr Cloud Compute
SSHDOCK

Full terminal in your browser. Local credential storage, jump host tunneling, live CPU/memory/disk metrics, and a mobile soft-key bar. Free to use. Built by developers, for developers.

© 2026 SSHDock

GitHub (@ayanhackspro)
App
Launch TerminalFeaturesHow it worksBlog & TutorialsChangelogGuides
Cloud Guides
AWS EC2DigitalOcean DropletGoogle Cloud Compute EngineMicrosoft Azure Virtual MachineLinode Compute InstanceVultr Cloud Compute
Legal & Contact
Privacy PolicyTerms of ServiceDisclaimerContact UsAbout Creator
Modern, minimal browser SSH client
TerminalSitemap