Search code examples
google-cloud-platformgoogle-compute-engineputtygcloud

gcloud compute ssh stops


I am using gcloud ssh to connect gce.

> gcloud compute --project "first-medium-2****8" ssh --zone "us-east1-b" "instance-2"

I entered the above command to powershell ,but it replies

>Using username "hogehoge".

>Authenticating with public key "DESKTOP-****hogehoge"

and stops. Nothing happened after all.

Yesterday I did the same thing and there was no problem.

But today, I can't. I tried gcloud init and reinstalled the gcloud.

But nothing changed. What should I do to solve this problem?

Additonal information.

  • OS Windows10

  • Google Cloud SDK 237.0.0

  • PowerShell 5.1.17134.590

  • Putty 0.70 (only one installation)

note1:I found I could use cloud shell without problem. But, cloud shell has timeout.So I prefer gcloud to cloud shell.

note2:When I use cloudshell, it connects as "tomotomo". Not "hogehoge" which username when I use gcloud.

When I run "gcloud compute ssh VM_NAME --verbosity=debug --log-http"

it replies

>DEBUG: SSH Known Hosts File [C:\Users\hogehoge\.ssh\google_compute_known_hosts] could not be opened: Unable to read file
[C:\Users\hogehoge\.ssh\google_compute_known_hosts]: [Errno 2] No such file or directory: u'C:\\Users\\hogehoge\\.ssh\\goo
gle_compute_known_hosts'
DEBUG: Current SSH keys in project: [u'tomotomo:ssh-rsa AAAAB*** 
DEBUG: Running command [C:\Users\hogehoge\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin\sdk\putty.exe -t -i C:\User
s\hogehoge\.ssh\google_compute_engine.ppk hogehoge@3*****].
DEBUG: Executing command: [u'C:\\Users\\hogehoge\\AppData\\Local\\Google\\Cloud SDK\\google-cloud-sdk\\bin\\sdk\\putty.ex
e', u'-t', u'-i', u'C:\\Users\\hogehoge\\.ssh\\google_compute_engine.ppk', u'hogehoge@3*****']

It was very long, so I only extract which I think important.


Solution

  • Running

    putty -cleanup

    solves this problem.

    Putty saves some information in registry.(IP address,public key and so on)

    This command removes those registries and random seed file.