Lost Acccess to VM
When you create the VM in the NREC dashboard, you also define which SSH keys should be able to access the VM.
You should be aware that it is not possible to change which SSH keys can access the VM in the NREC dashboard after the VM has been created, and the only way to change this is to SSH to the VM after it has been created and then add/edit the SSH keys in ~/.ssh/. This means that if the only way you can access the VM is via a single SSH key pair and you lose access to this SSH key on your computer (either due to getting a new computer or reinstalling the operating system), you might up end in a situation where you are hardlocked from accessting the VM.
This means that you should either consider giving multiple users SSH access after the VM is acc
Accessing the VM via the dashboard console
It is possible to access the VM via the console in the NREC dashboard, but you should be aware that the root user by default has no password. This means that this login possibility is only available if you manually have set the password for the root user for your VM or any other users, and that you have stored this password in a suitable location.
Help, I have hardlocked myself out the VM, what do I do?
The official docs of NREC has a section on what to do if you have lost acccess to the VM. In my experience, attempting to access the GRUB menu is difficult, and I was not able to access this from the BIOS menu in order to set a user password.
The recovery process I used was to create a snapshot of the VM that was lost access to was he following:
- In the NREC dashboard, create a snapshot of the VM you want to gain access to.
- Create a new VM with the image of the snapshotted VM. In the setup process, you are able to add your new SSH key.
- Then, verify that you can ssh to this new VM. If you don't need to preserve the IP address of the VM, you now have a functional copy of a recent state of your VM and you can continue using it as is. If you wish to, you can also edit the password for the root users to gain access from the dashboard console. If you need to preserve the IP address of the original VM, you can move to the next step
- In the NREC dashboard, create a snapshot of the new VM.
- Using the "rebuild" function on the original VM, you can then recreate the VM with the same IP address and with the snapshot you have SSH access to created in the last step. When finished, the NREC dashboard will say that you still have access with the old key pair, when in reality you can access this with your new SSH key.
- Verify that you can access the VM using your new SSH key.
- You can then optionally delete the intermediate VM you created.