- 0 0
So I changed my Ubuntu password via my Cloud interface and next thing I know my Ubuntu password didn't take and the old one was some randomly generated password from my Ubuntu template. Shit! So how do you recover a root Ubuntu password?
Well the trick I learned is only applicable to people who can reboot the Linux machine and view the GRUB menu on start-up. If this is you then by golly you are also in luck. The example below drops into the root shell in order to change the password.
Reboot your Ubuntu machine. While Ubuntu is starting starting hit the SHIFT until you see the GNU GRUB menu loading. Once the menu displays as shown below hit the e in order to edit the boot options.
Once the Edit Boot Option menu opens locate the line that starts with: linux /boot/vmlinuz (The second to last line in the screenshot below). At the end of this line add the following: rw\ init=/bin/bash. Hit F10 or CTRL-X to reboot Ubuntu. Ubuntu will now start with these options taking directly to the shell as the root user.
Once the shell has come up type the following commands to reset your Ubuntu root password:
At the command prompt type: passwd
This will trigger the reset password procedure for the root user.
Finish the Ubuntu password recovery process by rebooting once more. This will boot the Ubuntu machine back into normal boot mode.
Good luck and I hope you recover your Ubuntu Password!