How to reset the password in a dedicated server?
Note: The following tutorial applies to Ubuntu 20.04. The password reset process on other versions of operating systems may be different.
linux /vmlinuz-5.8.0-40-generic root=UUID=123123123-123123-123-123-123 rw XXXXXXXXX
Note: The numbers in the line may differ, which is why there are strings 123, but we are interested in the end of the line starting with "RW."
linux /vmlinuz-3.13.0-29-generic root=UUID=123123123-123-123-123
In place of the deleted part, we need to write the command:
rw init=/bin/bash
So that a command like this is formed:
linux /vmlinuz-3.13.0-29-generic root=UUID=123213123-123-123-123 rw init=/bin/bash
passwd root
Now we enter the new password, type it again and press ENTER.
Lastly, we reset the machine.
Note: In case the "passwd" command doesn't want to work, we can add a single command before that:
mount | grep -w /
After the whole process, the text that was edited should return to its state before the changes. Then we can repeat the initial steps from the tutorial and enter GRUB again and check if the text has returned to its initial version.
Done! Your password has been reset.