How to Reset Forgotten Root Password in Debian 10

In this brief tutorial, you will learn how to reset a forgotten root password in a Debian 10 system. This will help you regain the ability to log in as the root user and carry out administrative tasks.

So, first power on or reboot your Debian 10 system. You should be presented with a GRUB menu as shown below. On the first option, proceed and press the ‘e’ key on the keyboard before the system starts booting.

Debian Grub Menu
Debian Grub Menu

This ushers you to the screen shown below. Scroll down and locate the line that begins with ‘linux’ that precedes the /boot/vmlinuz-* section that also specifies the UUID.

Grub Kernel Parameters
Grub Kernel Parameters

Move the cursor to the end of this line, just after ‘ro quiet’ and append the parameter init=/bin/bash.

Next hit ctrl + x to enable it to boot in single-user mode with the root filesystem mounted with read-only (ro) access rights.

For you to reset the password, you need to change the access right from read-only to read-write. Therefore, run the command below to remount the root filesystem with rw attributes.

:/# mount -n -o remount,rw /
Mount Debian Filesystem
Mount Debian Filesystem

Next, reset the root password by executing the good old passwd command as shown.

:/# passwd
Reset Root Password in Debian
Reset Root Password in Debian

Provide the new password and retype it to confirm. If all went well and the passwords match you should get a ‘password updated successfully’ notification at the end of the console

Finally press Ctrl + Alt + Del to exit and reboot. You can now log in as the root user using the newly created password that you just defined.

And that’s how you reset a forgotten root password on Debian 10.

If you liked this article, then do subscribe to email alerts for Linux tutorials. If you have any questions or doubts? do ask for help in the comments section.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

7 thoughts on “How to Reset Forgotten Root Password in Debian 10”

  1. Hello!

    I have not used my Debian 10 for almost a year. When trying to log back on, I keep getting the message that my password is incorrect, even after I followed all the steps in this article. I tried with different user names as well, but I know for sure that the first try was correct. What can I do in this case?

    Thanks!

    Reply
  2. Hi,

    When the GUI comes up, so far as I know, you cannot log in as root, you have to login as a user that you set up when you installed the system. So how does changing the root password help when it’s the user password you use to login and the one most people will need/have forgotten?

    Reply
    • Hey Hugo, while you cannot log in as root via the GUI, changing the root password is helpful if you want to make system changes that require elevated privileges provided for by the root user. Imagine a situation where you want to changes to the system or add /remove new users but you have forgotten the root password.

      Additionally, if you want to change a regular user’s password, you can do so in the very last step. Simply run

      # passwd username
      
      Reply
  3. After I do all that, my installation boots to a prompt that says, “enter root password or press e to continue.”

    Reply
    • Hey David. Whilst the main purpose of this article is to show users how they can reset the root password, you can also configure your system to disable editing of the grub menu parameters. This effectively locks out anyone who would want to reset the root password.

      Reply
    • Do people have physical access to your servers? Bad
      Do people have access to your management/time? Bad

      Can’t help the above? Use Luks Encryption

      Reply

Got something to say? Join the discussion.

Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.