Article overview

Help article

Resetting your root password in Ubuntu and Debian

Over time you may forget your root password, but luckily there usually is a solution. In this tutorial, we will show you how to reset your root password in Ubuntu and Debian.

  • These steps have been tested in Ubuntu 20.04, 18.04 and Debian 10.
     
  • Do you still have your root password, but have you lost another user's password? Then use the following command as root user to change the password::
    passwd username
    

 

Step 1

To reset your root password, first go to the Grub menu of your VPS.

Restart your VPS and press 'ESC' on your keyboard as quickly as possible to interrupt the startup process (the necessary screen only appears for a very short time).

Please note: use the VPS console in the control panel and press ctrl-alt-del instead of the restart button. The screen below will then remain on the screen for a longer period of time.

You will be shown the following screen (approximately):

ubuntu grub menu


 

Step 2

Press the 'e' key on your keyboard to be able to change the boot parameters (see the bottom of the screenshot above). By default, the kernel is set to start in ro-mode (read only):

ubuntu grub parameters read only

In Debian it will say 'ro quiet'. Change 'ro' / 'ro quiet' to 'rw init=/bin/bash' (without parentheses). Because the text doesn't completely fit on one line, you'll see a \ added to the end of the line to indicate that the text continues on the next line.

The result looks like this:

ubuntu grub parameters read write

Now press ctrl + x to start your VPS with the modified boot parameters.


 

Step 3

After starting your VPS, you will arrive at a bash prompt. You can now reset your root password with the command:

passwd root

 

Step 4

Finally, reboot your VPS with the command below. The addition -f (force) may be necessary here to perform the reboot.

reboot -f

 

Your root password has now been reset! This brings us to the end of this tutorial to resetting your root password in Ubuntu and Debian.

Should you have any questions left regarding this article, do not hesitate to contact our support department. You can reach them via the ‘Contact Us’ button at the bottom of this page.

If you want to discuss this article with other users, please leave a message under 'Comments'.

Has this article been helpful?

Create an account or log in to leave a rating.

Comments

Create an account or log in to be able to leave a comment.