It is a major problem when we forgot our root password in linux. But don’t know how to recover it. First thought that came to mind reinstall machine. But I found a way that might help you without reinstall and save your hours. It is a interesting trick in linux to get back our root password in few minutes. I used it on ubuntu 11.10 it work fine for me. Some people might know about this method, but I thought i share with you all for those who don’t know.
Caution : But please don’t play with this for fun, only use it when in need.
Here are the steps to get back your password :
1. Reboot your system.
2. When Grub Loads, Either move arrow to stop clock/timer.
3. Select Ubuntu Kernel, and then Press ‘e’ key to open it in Edit Mode.
4. In edit mode, screen will look like this in Ubuntu…
If you see the 2nd line from bottom, that says info about kernel add ‘1’ in end of command as given below,
linux /boot/vmlinuz-220.127.116.11 root=UUID=904bf39-9234 ro quiet splash 1
5. Then Press Ctrl + b to boot kernel in single user mode.
6. By using passwd command reset your root password,
New UNIX Password:
Retype UNIX Password:
passwd updated successfully
7. Now reboot the machine, machine will reboot with your new password.
I hope it helps. 😉