Sometimes users forget root password. In Linux password can be recovered by booting Linux under single user mode and creating new password by entering bash shell prompt.

In order to boot system under single user mode we need to reboot the system.

  • Reboot the system, during booting process it will ask to press any key to enter the menu:

Root Password 1

  • Pressing any key will show Grub Menu where you can select Kernel version:

Root Password 2

  • After highlighting the option with UP/Down Arrow key press ‘e’ in order to edit commands in Grub menu screen, it will show option where one can select Kernel Version. Make sure you select the option starting with ‘Kernel /vmlinuz-….’ and again press ‘e’.

Root Password 3

  • After pressing ‘e’ it will take you to Kernel Boot Option where you need to give single space and type ‘1’ or ‘S’ or ‘Single’ at the end of the line then press ENTER.

Root Password 4

  • Now press b (Note: These options are temporary in order to recover root password) which will boot the system in single user mode and Bash prompt will be displayed.
  • Now Type command ‘passwd‘and it will ask for new password.

Root Password 5

  • Enter new password and reconfirm the same which will update the password.
  • Now you can enter any run level from this prompt by typing ‘init runlevel’ where runlevel can range from 1 to 6.