How to reset forgotten root password in Linux?
The root password for the Linux system can be reset by booting it into the Single User mode which is also termed as Emergency mode or more popularly known as Rescue mode.
If the boot loader installed on your Linux system is GRUB, then please follow the below listed steps to reset the root password.
- Select the line which specifies the kernel to be loaded.
- Press the ‘e’ key to edit the entry.
- Choose second line (the line starting with the word kernel).
- Press the ‘e’ key again to edit kernel entry
- Append the letter ‘S’ or word ’single’ to the end of the line.
- Press the [ENTER] key
- Press the ‘b’ key to boot the Linux kernel into single user mode
After the booting process completes, mount the ‘/’ and ‘proc’ partitions using the below listed commands.
# mount -t proc proc /proc
# mount -o remount,rw /
'passwd'command to change the root password.
Finally, reboot the system employing the below commands.
If the boot loader installed on your Linux system is not GRUB but LILO, then please follow the below mentioned steps to reset the root password.
- At the
Boot:prompt displayed by the LILO boot loader, type
linux singleand press the [ENTER] key:
- Allow the system boot and when it displays the
passwdto reset the root password.
- Finally, reboot the system by issuing
syncfollowed by the