When you forgot root password.
What can you do when you cannot log in because your password is rejected? After reading this article, you will be able to resolve the situation easily. I will cover two bootloaders:
- GRUB If your bootloader is GRUB, change the password as follows:
- If GRUB is password-protected, use a boot disc to enter rescue mode. Enter chroot /mnt/sysimage, then passwd to change the password. Reboot to return to normal operation.
- If GRUB is not password-protected, this is even easier. You can use the method above, or follow these steps: at the GRUB boot screen, press e to view its details, then press e again on the kernel line. On the kernel line editing screen, append s to the line. Press Escape and then b. The system boots into single-user mode. Enter passwd to change the password, then enter exit (without restarting) or reboot.
- LILO I am not sure whether anyone still uses LILO. (I have never used it myself.) Its solution is as simple as GRUB’s: when the LILO boot prompt appears, enter linux single and press Enter. After booting, enter passwd root and set the password as usual. Finally enter exit (without restarting) or reboot.