π§ Resetting the Root Password on Debian
If you've forgotten the root password on your Debian system, you can reset it by following these steps:
1. Reboot the System
If your system is running, restart it.
2. Access the GRUB Menu
As the system begins to boot, you should see the GRUB menu.
If it doesnβt appear automatically, hold the Shift key during startup until it does.
3. Edit Boot Parameters
Use the arrow keys to highlight the default boot option (usually the first one).
Press
eto edit the boot entry.
4. Modify the Linux Line
Locate the line starting with
linux.Navigate to the end of this line, add a space, and append the following:
init=/bin/bash
5. Boot into Recovery Mode
Press Ctrl + X (or F10 on some systems) to boot using the modified parameters.
This will launch a minimal shell environment.
6. Remount the Root Filesystem
Once at the shell prompt, make the root filesystem writable:
mount -o remount,rw /7. Change the Root Password
Now reset the root password:
passwdEnter your new password when prompted and confirm it.
8. Reboot the System
After updating the password, reboot:
rebootYour system will restart normally, and you should now be able to log in as root with your new password.