Hanzawa Naoki
Hanzawa Naoki

Reputation: 503

Problems in ssh to vm in google cloud

Hi Ive just started using google cloud and i was following the tutorial

https://www.youtube.com/watch?v=gxZvofAvgHQ#t=40

and i was stuck at around 4.18 where i cant ssh as when i pasted my gcutil --service_version="v1" --project="stone-ground-609" ssh --zone="us-central1-a" "instance-1"

it gave me the error putty fatal error

can anyone shed some light on this?

Upvotes: 1

Views: 4194

Answers (2)

Polyvinyl
Polyvinyl

Reputation: 51

You will have to generate an SSH key to authorize your computer to connect to your server

  • SSH keys come in 2 parts
    1. The public key
    2. Your private key

Think of public as a lock and the private key is the key that only you have to open that lock.

If there are others who need access to your server, each of those users and machines should get their own SSH keys.

To create the SSH Key pair, the steps to do that are different if you are on Mac or Linux compared to Windows.

Windows: Download PuTTY

Create the SSH Key: open the application PuTTYgen

  • Click start
  • Create randomness, by moving your mouse
  • For the key comment type in the username of your VM
  • Click Save Private Key (end the file name in .ppk)
  • Click Save Public Key (end the file name in .pub)
  • Upload the Public Key to your VM by chosing in in the Google Cloud Console and clicking "Edit VM"

Connect via SSH: Open Putty

  1. In Host Name type in your Google VM's IP Address
  2. In the left hand navigation bar choose 'Connection' -> 'SSH' -> 'Auth'
  3. Under "Private key file for authentication:" Click Browse and locate your private key
  4. Under 'Connection' -> 'Data' Type in the VM username in "Auto-login username"
  5. Click back to ‘Session’
  6. Save the settings
  7. Click 'Open'

Mac: Open the Terminal

Create the SSH Key

Type in ssh-keygen -t rsa -f ~/.ssh/{filename} -C {username}

Upload the Public Key to your VM

  1. In the terminal type cat ~/.ssh/{filename}
  2. Back in Google Cloud's Console: Click on your instance name
  3. Click 'Edit'
  4. Scroll down to 'SSH'
  5. Paste
  6. Save

Connect via the Terminal

Type in ssh -i ~/.ssh/{private-key} {username}@{ip-address}

Hit enter

Upvotes: 0

Faizan
Faizan

Reputation: 1967

In order to use putty you need to setup you ssh keys. You can follow the steps mentioned in the following link to setup Putty. https://developers.google.com/compute/docs/console#start

Upvotes: 1

Related Questions