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.
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.
Move the cursor to the end of this line, just after
‘ro quiet’ and append the parameter
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
:/# mount -n -o remount,rw /
Next, reset the root password by executing the good old passwd command as shown.
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
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.