Steps on how to reset your Debian root password
- Reboot your system: If your Debian system is running, restart it.
- Access the GRUB menu: As your system boots up, you should see the GRUB boot menu. If you don't, press and hold the
Shift
key while your system restarts. - Edit boot parameters: Highlight the first boot option (usually the default one) and press
e
to edit its parameters. - Modify the Linux line: Find the line starting with
linux
and navigate to the end of it. Add a space and then typeinit=/bin/bash
. - Boot into single-user mode: Press
Ctrl+x
to boot the system with these modified parameters. This will start your system in a limited recovery mode. - Remount the root filesystem: In the recovery environment, type the following command and press Enter:
mount -o remount,rw /
This command changes the root filesystem to read-write mode, allowing you to modify the password file.
- Change the root password: Now you can reset the root password using the
passwd
command:
passwd
You'll be prompted to enter and confirm the new password.
- Reboot the system: After setting the new password, type
reboot
and press Enter to restart your system.
You should now be able to log in with your new root password.