Skip to content

Instantly share code, notes, and snippets.

@feczo
Last active July 23, 2020 13:14
Show Gist options
  • Save feczo/7282a6e00181fde4281b to your computer and use it in GitHub Desktop.
Save feczo/7282a6e00181fde4281b to your computer and use it in GitHub Desktop.
How to use Compute Engine - GCE with putty

Pre-requisite: go to http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html download http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe and http://the.earth.li/~sgtatham/putty/latest/x86/puttygen.exe

Run puttygen and generate the key

  1. Click 'Generate' move the mouse around as instructed and wait

  2. enter your desired username

  3. enter your password

  4. save the private key

  5. copy the entire content of the 'Public key for pasting into OpenSSH authorized_keys file' window. Make sure, you copy every single character from the beginning to the very end!

  6. go to the cloud console http://cloud.google.com/console select your project and under Compute Engine / VM instances click on 'New instance' click on the advanced options link paste in the contents copied at step 5 into the entry box indicated

7. note the IP address of the instance once it is complete

8. Open putty, from the left hand menu go to Connection / SSH / Auth and define the key file location which was saved at step 4

9. from the left hand menu go to Connection / Data and define the same username as the one at step 2

10. Enter the IP address noted at step 7 11. name the connection below saved Sessions as 'GCE' click on 'Save'

12. double click the 'GCE' entry you just created 13. accept the identy of the host

14. login with the password given at step 3

15. sudo su - and you are all set

@thiwanka25
Copy link

@ali-cognitro you save my day brother. Thanks

@mp
Copy link

mp commented May 31, 2020

Followed every bit of your instruction when I double click on GCE it opens the terminal and shows "server refused our key"

This is a great tutorial, but step 5. is incomplete.

You need to paste your public key into your home directory's .ssh/authorized keys folder and then chmod it (log in using the Google console's HTML based SSH client). Follow both answers given in https://stackoverflow.com/questions/20249633/how-to-overcome-server-refused-our-key:

  1. user1789769's answer of pasting your public key into into .ssh/authorized keys (I had to create this file)
  2. m.nguyencntt's answer of chmodding .ssh/authorized keys

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