0

My ssh Keys in Vm Instance are showing "expireOn":"2020-11-20T00:06:44+000"

since then i am unable to connect to my VM and also not able to connect via SSH

Please guide on how to update the ssh keys on GCP

2 Answers2

1

You can upload your own SSH key. But I advise you to use Cloud IAP (Identity-Aware Proxy) to securely access your VMs. Protecting your cloud VMs with Cloud IAP context-aware access controls!

  • Error updating SSH keys: open /home/.ssh/authorized_keys.google: no space left on device." I have already doubled the disk space still getting this message in logs can you guide for a resolution – Shrih Dezigns Nov 20 '20 at 10:35
0

Reading the second error you posted, I think that the resize of the disk didn’t work as you expected. Also, I think that you are trying to add a SSH key because you are unable to access via SSH as usual, but unfortunately you wouldn't be able to access even if you add your own SSH keys, unless you fix the disk size issue.

You should check if you have partitions, because it could be that /home/ is a different partition and it should be resized as well. Here you have the documentation that explains in detail how to resize partitions in a Linux Instance.

To access your Instance, alternatively to SSH you could use Serial Console

  • First of all, you will need to enable Serial Console Access in that Instance.
  • If you know the password of the root user account for this VM instance, then try to access via Serial Console using the root account.
  • If you don’t know remember the password or never setup it, follow this procedure:
    • Go to the VM instances page and click on the instance name of your VM
    • Click the Edit button at the top of the page
    • Under Custom metadata, click Add item
    • Set "key" to startup-script and set "Value" with the following script:

#! /bin/bash echo "root:<---YOUR-PASSWORD--->" | chpasswd

NOTE: Change the value "<---YOUR-PASSWORD--->"" for a password of your choice. For security reasons, I would recommend you to remove the startup script and change the password from within the instance once you regain access to the instance, otherwise anyone with view access to this VMs can see the password.

  • Reboot your Instance, this way the startup-script will be executed.
  • Try to access Using Serial Console

Once you were able to access your Instance, you could check your partition table and the space left with this commands:

  • df -h
  • cat /etc/fstab

Then, you should follow this documentation to resize partitions in Linux Instances that I previously mentioned.

Regards

agmance
  • 36
  • 3