Linux, Tutorials

Root password lost – recover it here!

Need to login on to LINUX machine – but don’t have the privilege? – or want to gain root privilege?
Pre Requisite – you need the access physical or command line or console access to reboot the machine.

Follow the steps :-

  1. The very first screen when you restart the linux machine – press an enter or space whichever works and this will take you to the snapshot of step 2.

Kernel menu

Fig 1

  1. You will get this screen –


Fig 2

Press Enter. You will get the screen in Fig.3

Kernel console

Fig 3

Press e in the end of 2nd line , the one starting with kernel, to enter the edit mode.

  1. You will get the screen in fig 4, add “s” at the end to login next time in single user mode Type Enter

single user mode

4. After the step 3 you will get this screen, press b to reboot.

After single user edit

  1. After the reboot, below is the screen you will get-

After Reboot

Now you can change the password by typing passwd,it won’t ask you this time for the old password.

password change

Now, you have successfully changed the root password.

PS : Remove thes “, that you have put in there previously by using the same procedure. And next time you reboot you can login as root!!

Any query/help/suggestion/feedback regarding this is welcome. Please feel free 🙂 

Comments are closed.