Skip to content

Instantly share code, notes, and snippets.

@neolaw84
Created May 6, 2021 07:32
Show Gist options
  • Save neolaw84/4b93b6dd115a752868babf123bae5f2c to your computer and use it in GitHub Desktop.
Save neolaw84/4b93b6dd115a752868babf123bae5f2c to your computer and use it in GitHub Desktop.
Enabling SSH log-in to Google Cloud VM

Enabling SSH log-in to Google Cloud VM

Situation

We want to SSH into the newly created VM in Google Cloud. We already have the private key (id_rsa) and associated public key (id_rsa.pub)

Pre-requisites

  • You should have permossions to run gcloud utility.

Actions

  1. go to console.cloud.google.com and click "SSH" for this instance.
  2. upload your public ssh key (click the gear icon on top right).
  3. chmod 400 the_uploaded_key.pub
  4. "gcloud auth login" and follow the authentication prompt
  5. "gcloud compute os-login ssh-keys add --key-file=the_uploaded_key.pub --ttl=0"

Results

We can log-in via SSH. Yay!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment