Recover the root password on Debian 11

Estimated reading time: 1 min

Introduction

In this article, we will learn how to recover the password of the root user account on the Debian 11 operating system.

Prerequisites

  • you should have a server installed with Debian 11
  • you should have access to the Snel.com client area to open the KVM console

Recover root password

Step 1: Log into the KVM console

In order to change the root password you will need to log into the KVM console, depending on which server type you are using the methods may differ.

If you are using Cloud VPS please refer to this article

If you are using a dedicated server with iDRAC please refer to this article

If you are using a Supermicro servers please refer to this article

For VPS users navigate to under the VPS service details page, from there you can click Console, this will open the kvm console on a new browser.

Step 2: Reboot the machine

While you have your KVM console open, reboot the server to get the GRUB menu.

Dedicated server users will have to open Server Power Control

right after that click reboot to restart your server.

VPS users: Open the service details page of the VPS and click on the reboot button

Note: After rebooting your server quickly go to the KVM console as GRUB menu waits only a few seconds before booting OS.

Step 3: Modify boot parameters

After rebooting the VM quickly switch to KVM console and keep pressing the ESC.

You will need to do this very quickly to get the GRUB menu.

 Note: If you missed the grub screen, go ahead and reboot your server again.

In GRUB menu, press E to edit the GRUB parameters

In GRUB edit mode, find the line which starts with linux /boot/ , next you will need to navigate to the end which should show ro quiet , add a space and type the following:

init=/bin/bash

it should look like this:

linux          /boot/vmlinuz-5.10.0-18-amd64 root=/dev/sdal ro quiet init=/bin/bash

Once done, press CTRL + X or F10 to boot in single-user mode.

Step 4: Reset password

Next you will need to change the acces right from read-only to read-write, to do so type the following command:

mount -o remount, rw /

Now we can change the root password, run the following command to change your password:

passwd

to change your password.

After that you can reboot the server with the following command:

reboot -f

 Conclusion

In this tutorial we have shown how to recover the root password for Debian 11

Was this article helpful?
Dislike 0
Views: 5502

Reader Interactions

Leave a Reply

Your email address will not be published. Required fields are marked *