Introduction
If you forget your root password of your ubuntu server you can use this method.
If you are using a bare metal server or a vps all you have to do is restart your server and press escape “ESC” key.
this will prevent Server OS to boot and bring up the GRUB boot promt. if you skip this step and boot in to OS then you need to restart your server again.
At the GRUB boot promt, press ” E ” to edit the first boot option which will be ” Ubuntu “
Find kernal line starting with
linux /boot/
add space in the end of that line and add this command
init=/bin/bash
Press CTRL + X or F10 to boot into single-user mode.
the system will boot and you will see the root prompt.
mount -o remount,rw /
type above command to mount the system volume, for me it gives me an error but works.
now type command to reset your password.
passwd
This will ask you to type your password twice to confirm then reboot the server.
Hope this will help you, if you have any question please let me know.
0 Comments