1

I was using digitalocean and want to try out gcp compute instance. I created an ubuntu instance, did cat ~/.ssh/id_rsa.pub in my terminal and added onto the instance. Then I tried ssh james@external ip in my terminal (I'm using mac) but it just hang there.. then a min later, I got Connection refused error. What's wrong?

1
  • Did you create the user james on the instance? The normal method of connecting to a Google Cloud instance is via gcloud compute ssh NAME-OF-INSTANCE --zone ZONE-NAME Commented Dec 23, 2018 at 5:38

2 Answers 2

1

There are numerous possible reasons for this, but mostly likely you're missing a firewall rule to allow connections from the outside:

gcloud compute firewall-rules create default-allow-ssh --allow tcp:22

If this doesn't help, check out the Troubleshooting SSH article in the GCP docs.

Sign up to request clarification or add additional context in comments.

Comments

1

First check your network can communicate to compute engine via simple ping command.

ping <GCE external IP>

or

telnet <GCE external IP> 22

If you getting request timed out then most probably firewall issue. go to cloud console and create/update firewall rule under VPC section. search tcp:22 in firewalls section and edit/create firewall rule (add your IP ranges into source IP range section) for ssh connection.

refer: https://cloud.google.com/sdk/gcloud/reference/compute/firewall-rules/create

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.