To reset the root user password, you need to have physical access to the server with a connected monitor and keyboard, or use remote access tools such as IPMI for SuperMicro, iLO for HPE, or the noVNC console for managing our virtual servers.
First, you need to power on or restart your server. During the boot process, you will see the GRUB menu.
--If your system is running in VirtualBox, to call the boot menu, you need to press the SHIFT key on the keyboard.--
Now you need to press the E key on the keyboard to edit the grub parameters. Then scroll down to the line that starts with “linux” and ends with “ro ***”
We change the text in this line starting with “ro” and ending at the end of the line to “rw init=/bin/bash” in order to enable write access root to the file system.
Press “CTRL + x” or “F10” to reboot the system. Use the command “#passwd” to change the root password.
We enter the new password twice. If everything is successful, we will see the message "password updated successfully."
And reboot the system using the command “#exec /sbin/init”