How do I set up ssh keys in Google Compute Engine?

Yossi Neiman picture Yossi Neiman · Jul 16, 2014 · Viewed 16.7k times · Source

I am trying to set up ssh keys through the Google Cloud Platform console. I made a key in Puttygen, but what is the format to paste it into the console? I got this error:

Error: Invalid key. Required format: <protocol> <key-blob> <[email protected]>

Answer

Daryl Van Sittert picture Daryl Van Sittert · Aug 13, 2014
  • After opening puttygen, select SSH-2 RSA and change the number of bits to 2048
  • Click on generate and follow the instructions
  • In the Key Comment textbox, put your email address
  • Fill in the passphrase boxes too for good practice
  • Save your private key somewhere
  • Copy all of the text from the top, greyed-out textbox

You should end up with the following in the google ssh keys textbox

ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQB5h1cM5uLB+1C7Al+RNuKoFz81P4mw89pYPDuARzZTNFPguHsfUNZ6Xtq2LF/CDoRh9G3Y9xt12H5TWdeZdmdaokwbtQYba86Ve7w0eLEw0Bwy4eQCC/hsVzNY37pUbdGBMbhOoYfJQ1gnz+4kZBtgNlk3PQiyWkBzBcIt6qHgd/ax8mS8Ty+0/cD1X50yEzyr/anP/WowZYIDb5rtM/+Rb/qZ6wZl1ka+AulT+9cH59ChHLDzeZc6NdJYhmS6K5DDebRaRWdviOiI+RpSMZz0hsHaGnQdpfrzswIwPolrA+nKQ24WZDPgWAzCAlvuLRdYB3dGDkLCnypAfHzwGyTj [email protected]

Then open putty, fill in the Session details and then go to Connection -> SSH -> Auth and click browse under Private key file for authentication.

After clicking open, your login name is the user part of your email address (before the @). It will ask you for your passphrase too.