Close
    logoMevspace Docs
    English

    How to reset the password in a dedicated server?

    Reading time: 2 min

    Note: The following tutorial applies to Ubuntu 20.04. The password reset process on other versions of operating systems may be different.

    1
    To start the password reset restart the server. While it is booting up, press ESC and then hold SHIFT. This will enter GRUB.
    2
    We stay on Ubuntu and click E on the keyboard, and the command line will show us. (We can take a screenshot at this point before changes. In case the method doesn't work the screenshot taken will help change the command line lines to the initial version).

    how to reset the password in a dedicated server 1

    3
    Then we find the following line (usually it is before or at the end of the code):
    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."

    4
    In turn, delete the end of the line starting with RW so that the resulting command is as follows:
    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
    5
    Then press F10 on the keyboard. The system should reboot with the root console. Thus, we can reset the password.
    6
    We need to enter the command in turn:
    passwd root

    Now we enter the new password, type it again and press ENTER.

    Lastly, we reset the machine.

    how to reset the password in a dedicated server 2

    Note: In case the "passwd" command doesn't want to work, we can add a single command before that:

    mount | grep -w /

    how to reset the password in a dedicated server 3

    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.

    Previous
    How to report technical problems: template
    Next
    How to set up two-factor authentication (2FA)?