3
votes

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.

2
What OS? What version of PowerShell? What version of putty? What version of gcloud? Do you have more than one installation of putty (common on Windows)? The more details the better.John Hanley
Also, use debugging which might help you see the problem: gcloud compute ssh VM_NAME --verbosity=debug --log-httpJohn Hanley
@John Hanley I add more information. I hope it helps you.redpawn
What output to you get when you running the command in debug mode? What happens if you run your command from a Command Prompt instead of Powershell?John Hanley
I finally solve the problem. First I run "gcloud compute ssh VM_NAME --verbosity=debug --log-http" and run putty.exe directly. But I still have a same problem.It means putty.exe goes wrong. So I run "putty -cleanup" to cleanup putty and the problem solved. Would you write an answer?redpawn

2 Answers

1
votes

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.

0
votes

Running "putty -cleanup" as per @redpawn fixed the issue.