MobaXterm is my go-to remote access client from Windows. I prefer it to PuTTY for a number of reasons, which I won’t go into detail here, but include better GUI, better saved session information, clearer session info, macros, etc.
Ironically, I find using PuTTY (puttygen specifically) to *create* the key pair is the easiest process.
It’s free, and can be used as a Portable App or installed directly. https://mobaxterm.mobatek.net/
Anyhow – here’s how to set up your SSH keys to use it to SSH directly into your GCE rather than connecting through another PG instance.
—————————–
Creating SSH user for external app access. (This part is useful regardless of the client you use.)
1. Install PuTTY: https://www.putty.org/
2. Open “Puttygen”
3. Select the “RSA” button (ensure # of bits is set to 2048)
4. Click on generate and follow the instructions (move your mouse around to generate random info)
5. In the Key Comment textbox, put your email address
– it doesn’t matter what email you use, however the part BEFORE the @ symbol will be your login name. I.E. if you use [email protected] your SSH login will be testguy.
– Note that without some changes you can’t SSH directly in as root – and you don’t want to. So make sure your user has SU privileges or just switch to the root user after you log in (su root) – but make sure you’v set the root password first or that won’t work either!
6. Save your private key somewhere – you’ll use this location and key later in MobaXTerm
7. Copy all of the text from the top, greyed-out textbox – this is your PUBLIC key
!- this will be entered into the GCE Cloud Platform SSH section later, so don’t close PuttyGen yet in case you need to copy it again-!
Adding the key for use in Google Computer Engine – the recommended way (via Google Cloud Platform web interface.)
1. Go to your GCE “Google Cloud Platform Console”: https://console.cloud.google.com/?_ga=2.147913586.-473854088.1546545151
2. Select Compute Engine -> VM Instances
3. Click the name of your VM you want to create the SSH account on.
4. Click “Edit” at the top
5. Scroll down to “SSH Keys”
6. Click the box that says +Add Item
7. Paste the selection from PuttyGen – your public key – into the white box.
– it should show the username from the email address you used to create the key
– Be sure to follow the instructions carefully. Your key should start with “ssh-rsa AAAA…” not “— BEGIN SSH2 PUBLIC KEY”
– More specifically, it should be in the “id_rsa.pub” format if you’re using it from a file instead of copy/paste like I suggest.
8. Scroll down and select “Save”
Adding key to MobaXTerm
1. Create (or Edit if already created) the SSH Session settings for your GCE SSH connection.
– I assume you know how to create an SSH session in MobaXterm, if not – that’s a different set of instructions. 🙂
2. Go to “Advanced SSH Settings”
3. Click the box for “Use private key” and choose the file you saved earlier when creating the private key.
4. SSH into your GCE, as the user you created. SU to root as needed.