How to reset root password on Debian 9 (Stretch)
Have you forgotten your root user password on Debian 9?, do not worry, I will show you here, how to reset the root password on Debian 9. You simply follow the below steps and recover (set a new password) the root password.
Start your Debian 9 machine and Press any key to stop the boot process. Press “e” to edit the kernel command line parameters.
Use “down arrow” key for scrolling down. Go to the line that starts with the word “linux” and use “forward” arrow or press “End” button to go to the end of the line, and then add “init=/bin/bash“.
After you have added the entry, press “Ctrl + x or F10” to boot Debian 9.
Debian will now boot into single user mode, with the root filesystem mounted in “read-only mode“. So, use below command to mount the root file system in “read-write mode“.
mount -o remount /
Finally, change the root user password using “passwd” command.
Reboot your system and use the new password we set now for the root user on your system.