Connecting Securely to Google Cloud VM Instance With SSH Keys

Max Shestov
2 min readJan 19, 2021

--

There are several ways to transfer files to your VM instance, using WinSCP for Secure Copy Protocol (SCP) is one of them.

Create SSH keys to the instance using PuTTY.

Download putty.exe, if you don’t have it.
Open PuTTY Key Generator
Generate the keys
In Key comment field create a user name for your connection
Create Key passphrase (optional)
Save private key on your local machine
Copy your Public key from the field

In Google Cloud Console click on your instance, then click Edit

Scroll to SSH Keys, click Show and edit, + Add item
Enter Public SSH Key you copied before in PuTTY

Click Save.

Connecting to the instance using WinSCP.

Download WinSCP, if you don’t have it.
In Google Cloud Console copy the External IP on your instance

Open WinSCP and create a new connection
Choose SCP for the File protocol
In the Host name field paste the External IP you copied before
Type the User name you created in PuTTY

Click Advanced
SSH
> Authentication
In Private key file field point path to your Private key on your local machine

Next, click Enviroment > SCP/Shell
In Shell drop-down list choose sudo su -

Click OK

Now click Save and Login to your Instance.

--

--

Max Shestov
Max Shestov

Written by Max Shestov

Lead Web Developer. Husband of a wonderful wife, Entrepreneur, Dad

No responses yet