×



It's not uncommon for users to forget their root password. This happens especially when you stay for prolonged periods without using logging in or switching to root user. In case you have forgotten your root password, fret not. You can reset it in a few simple steps.

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related Linux system Management queries.

In this context, we shall look into how you can reset a forgotten root password in Debian 10 or 11.


How to edit the GRUB menu settings in Debian 11 ?

  • To get started, reboot your Debian system, and on the first boot entry (Debian GNU/Linux), press 'e' on the keyboard to access the GRUB editor.
  • You should be able to see a couple of lines on the editor like what we have here. Using your arrow down key, scroll down until you get to the line that begins with 'linux'. Using the arrow forward key , navigate to the end of the line.
  • Be sure to delete the 'ro quiet' attributes.
  • Once deleted, enable access to the bash shell by typing init=/bin/bash.
  • Next, press ctrl + x to boot into single-user mode.


How to Reset the password in single-user mode ?

Once you have accessed the single-user shell, mount the root filesystem with read and write access with the below attribute:

# mount -o remount,rw /

Therefore, reset the root password by typing the command:

# passwd

Enter your preferred root password and confirm. While at it, ensure that you provide a strong root password to avoid easily falling victim of bruteforce or dictionary attacks.

To effect the changes, exit the single-user mode and reboot by typing CTRL + ALT + DEL on the keyboard.


NOTE: The fact that you can change the root user password implies that someone else who might have physical access to your PC or server can do the same and compromise your system. To prevent this, you can enable a BIOS password or alternatively, encrypt your filesystem with a password so that no one else can access the system without the password.


[Need help in fixing Linux system configuration issues ? We can help you. ]


Conclusion

This article covers how to reset your root password in Debian 11 Linux system. In fact, you can now use the newly created password to log in or switch to your root user account.


More Linux Tutorials

We create Linux HowTos and Tutorials for Sys Admins. Visit us on IbmiMedia.com

Also for Tech related tips, Visit forum.outsourcepath.com or General Technical tips on www.outsourcepath.com