If you did not configure a password via User data and no longer have access to your SSH private key, you can reset the password from GRUB.
- Open the VM console via VNC and reboot the VM using the Ctrl+Alt+Delete button in the top-right corner. After clicking it, left-click inside the console window to ensure it has focus.
- Immediately after the reboot starts, press Esc repeatedly until the GRUB menu appears.
- Select Advanced options.
- In the recovery menu, choose Root.
At the root shell, run the following command to set a new password for the required user:
passwd <username>
If you receive a mount-related error, remount the root filesystem as read-write:
mount -o remount,rw /
- Reboot the VM and sign in using the new password.
Alternatively, you can recover access by creating a snapshot of the affected VM, creating a new VM from that snapshot, and configuring new authentication methods, such as additional SSH keys or allowing password authentication.
Comments
0 comments
Please sign in to leave a comment.