Setting a fresh Linux root password on a KVM VPS

For KVM-based VPS, it is not possible to change the root password from the administration panel, however, it is possible to "hack" your machine by booting it in single-user mode using VNC. Follow these easy steps if you no longer have access to your Linux operating system and you need to set a fresh KVM root password.
Start by activating VNC from the KVM-Panel.
VNC is some kinda "remote access to your server's keyboard and monitor".

1- Use the password indicated after activating VNC to login to noVNC which is provided in the panel.
(the button appears once you enable VNC)
2- Reboot your VPS.
3-  Press any key when the following message appears to enter the Grub (boot loader) menu.

4- Press ‘e’ on your keyboard to edit the kernel boot options.

5- Highlight the second stanzas (line) and press ‘e’ again.

6- You will now be able to edit the line highlighted in the previous step. Simply add ‘1’ at the end of the line as indicated in the following screenshot, then confirm pressing Enter.

7- Now you see the Grub stanzas as shown in step 5.
Press ‘b’ to continue booting, using the modified configuration. Linux will now boot into single-user mode, allowing for some special administrative tasks. (This will provide you with root access without the need to enter the root password) and can be used to set a new root password. Once the system is up and running type the following command to update the root password:
passwd root
You will be asked to enter a new password for the root user.
Once finished, reboot your VPS and you will be able to use the newly set root password

Add Feedback