myloginid
myloginid

Reputation: 1473

Cygwin - Connect to Google Cloud Compute

I am on a windows machine and use Cygwin for convenience rather than a full VM. I am trying to connect to a Compute Server using the ssh keys created in Cygwin rather than using Putty.

My Public key created in Cygwin is something like. Is this different from the one created by Putty Gen?

ssh-rsa AAAAB3Nza.......................qnBn yyyyyy@xxxxxxxx

I have added this to the Metadata and I am using the command as below

ssh -i .ssh/id_rsa -o UserKnownHostsFile=/dev/null -o CheckHostIP=no -o StrictHostKeyChecking=no [email protected]
ssh: connect to host 104.155.231.62 port 22: Connection timed out

I have disabled IPTables (just in case) to ensure that this goes thru.. However it always fails.. Is there a solution for this?

My tracert Output is as below -

tracert 104.155.210.118    
Tracing route to 118.210.155.104.bc.googleusercontent.com [104.155.210.118]
over a maximum of 30 hops:
  1     3 ms     5 ms     5 ms  192.168.0.1
  2     4 ms     3 ms     3 ms  nas01-gw.bhandup.hnsbroadband.com [123.108.225.9]
  3     4 ms     3 ms     6 ms  72.14.195.64
  4    14 ms     6 ms    18 ms  72.14.232.202
  5    34 ms    37 ms    41 ms  66.249.94.39
  6    69 ms    69 ms    64 ms  66.249.94.72
  7   112 ms   114 ms   113 ms  209.85.241.81
  8   122 ms   124 ms   124 ms  209.85.250.101
  9     *        *        *     Request timed out.
 10   117 ms   117 ms   116 ms  118.210.155.104.bc.googleusercontent.com [104.155.210.118]

Trace complete.

Thanks, Manish

Upvotes: 0

Views: 757

Answers (2)

myloginid
myloginid

Reputation: 1473

Solved -

Dont use the Google User id that is setup for the cloud server that are like xxxxxx_gmail_com - e.g.

ssh -i .ssh/id_rsa -o UserKnownHostsFile=/dev/null -o CheckHostIP=no -o StrictHostKeyChecking=no ***xxxxxxx_gmail_com***@10x.15x.2xx.6xx

Use the Local user systems user id

ssh -i .ssh/id_rsa -o UserKnownHostsFile=/dev/null -o CheckHostIP=no -o StrictHostKeyChecking=no ***myid***@10x.15x.2xx.6xx

Then run

sudo su - xxxxxx_gmail_com

Thanks, Manish

Upvotes: 1

Misha Brukman
Misha Brukman

Reputation: 13424

You need to add the public SSH key to the metadata, but specify the path to the private key to ssh to use in the connection. The client has the private key, the server has the public key.

You will need to change your command line from:

ssh -i .ssh/id_rsa.pub [...]

to:

ssh -i .ssh/id_rsa [...]

The easiest way to do both of these steps is to use gcloud compute ssh, part of the Google Cloud SDK.

Upvotes: 0

Related Questions