-1

I am unable to SSH into my instance on the Google Cloud Services.

I am not very well versed in VM management and troubleshooting, but have tried everything I knew, and google could provide to me including:

  • Attempting to SSH from an external program
  • Copying and mounting the disks on a new instance
  • Connecting to both using the serial console
  • Try all of above in a different hosting location

No matter what I try, the only result is a loading symbol followed by this:

The key transfer to project metadata is taking an unusually long time. Transferring instead to instance metadata may be faster, but will transfer the keys only to this VM. If you wish to SSH into other VMs from this VM, you will need to transfer the keys accordingly.

I can't do this, as I don't have the private key that is used by GCloud to SSH into the instance, and using PuTTY simply is not working, as any Public Keys given to the server by me don't work at all.

  • What OS is the instance? What did you do before this happened? – Michael Hampton Dec 21 '18 at 4:05
0

Public keys need to be enabled before they can be used by third party tools to access VM instances, was this done for the VM you are trying to connect through?

SSH access issues can be debugged through the /var/log/auth.log (Path is OS dependent so look for the correct path for your version of OS) or you can review the serial console output to view some additional details to help you troubleshoot the problem.

If you identify the possible root cause of the issue, you can enable interactive access to the serial console to fix it.

If you don’t have the root password, you can:

1. Go to the VM instances page in Google Cloud Platform console. 
2. Click on the instance for which you want to add a startup script. 
3. Click the Edit button at the top of the page.
4. Click on ‘Enable connecting to serial ports’
5. Under Custom metadata, click Add item. 
6. Set 'Key' to 'startup-script' and set 'Value' to this script: 
#! /bin/bash 
useradd -G sudo USERNAME 
echo 'USERNAME:PASSWORD' | chpasswd 
7. Click Save and then click RESET on the top of the page. You might need to wait for some time for the instance to reboot. 
8. Click on 'Connect to serial port' in the page. 
9.  In the new window, you might need to wait a bit and press on Enter of your keyboard once; then, you should see the login prompt. 
10.. Login using the USERNAME and PASSWORD you provided.

Serial console access is not secure so it is recommended that you disable it once you complete your work.

You can also debug this by running SSH Diagnosis scripts from a Linux Guest environment which are included with Linux instances created using Google-provided public images.

0

One of the reasons for receiving this error is that the firewall rules for the VPC are not configured to allow SSH ingress access to the instance. You can validate this configuration in the Google Cloud Console:

  1. Go to the project that your VM is active in
  2. Using the left side popout menu, select 'VPC network'
  3. Click on Firewall rules
  4. Check for a rule that allows SSH access via TCP on port 22 with a target that is inclusive of your instance or 'Applies to all'
  5. If the rule is missing, create the firewall rule, for the 'Source IP Ranges', enter the public IP address of your Internet connection or enter 0.0.0.0/0 to allow connections from anywhere on the Internet
  • The firewall rules for port 22 have already been set to all. I had access to this VM until the other day. no idea why it's doing htis to me. – CaptClockobob Dec 23 '18 at 20:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.