Vaneet Garg
Vaneet Garg

Reputation: 11

Transferring SSH keys to the VM. ( SSH Not working for the instance )

I have faced specifically issue with GC instance SSH. Whenever i try to open it just showing messages like below: "Transferring SSH keys to the VM." Or "You can drastically improve your key transfer times by migrating to OS Login."

But the domain seems fine and working well. Earlier domain was not working and then i restarted the instance. Then domain started working. But SSH still not .

Tried each possible way for debugging. Could not found something usefull.

Not sure key need to generate or not ! But i have few more projects on GCP and did not faced any kind of issue with that SSH .

I have attached the screen shot once so you can review. Domain url: http://zetile.com/

Kindly dig into this point and ans me something useful not any casual or reference link ans.

Looking forward to you !!

Thanks Best.enter image description here

Upvotes: 1

Views: 4234

Answers (3)

Ajay
Ajay

Reputation: 31

I was struggling with the same issue for a quite a long time. When I tried with a new browser (firefox in my case), it worked straight away. I believe some extensions in my google chrome cause the issue and so it's not working in chrome.

Upvotes: 0

This is a problem I've been going trough for some time and there don't seems to be any effective solution at least for me. So I hope this help.

Actually I didn't solve the problem but found a workaround. This won't let you access by SSH on your web browser but at least you will by CLI in your local machine. The workaround is this:

  1. You have to go to your user directory and check if you have this 2 folders: .config and .ssh.
  2. In .config you have to check for the gcloud directory and inside you have to look for 2 files and 1 directory: active_config, gce and configurations, respectively.
  3. In active_config it should be written default, in gce write True and in the directory, you need a file called config_default which inside have to have been written nothing.
  4. Then, in .ssh you need to add a file called authorized_keys and there should be a ssh public key file, which is created when you try to access your VM by console

If you went throug this steps, you should access without problems. And if you want to access your VM by console from another computer, you have to add a user in your VM with the same name of the another computer name, and repeat the process above.

Remember that the first time you go through this process should be when you create your Instance, by SSH on the GCP, because the first time you can access your VM without problems by that mean

Hope it could help :)

Upvotes: 0

Jose Luis Delgadillo
Jose Luis Delgadillo

Reputation: 2448

It could be a lot of reasons to not have ssh access. You might not be able to SSH to a VM instance because of connectivity issues linked to firewalls, network connection, the user account or maybe the ssh service is not running.

You could check your firewall rules and if it is not created you can create the rule for your port 22:

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

Try logging in as a different user with the gcloud tool by specifying another-username with the SSH request. The gcloud tool updates the project's metadata to add the new user and allow SSH access.

gcloud compute ssh another-username@$PROB_INSTANCE

I also suggest that you review the logs from the serial console for connection errors, you can check the following link for further information to know how to access the logs.

I recommend you to review with the SSH troubleshooting steps as described in the documentation

Additionally, you can take a look at the following documentation that explains how to control access to Linux instances by manually creating SSH keys and editing public SSH key metadata as alternative.

I hope this information would be useful to you

Upvotes: 1

Related Questions