07-24-2020, 09:06 AM
Password Recovery Ubuntu Server 18.04 LTS
Hello Post4VPS Community
In this brief guide I will provide instructions to perform a password recovery on a server or computer with Ubuntu 18.04 LTS or Ubuntu Server 18.04 LTS (it might as well work on older or newer versions). This information can be useful if you have forgot your root password. To perform the necessary steps you need to have VNC access or physical access to your server or computer.
Let's get started.
Step #1
Reboot your server or computer. When it is booting up hit the SHIFT key until you get into the GRUB boo tmenu. You migh need several tries depending on the hardware setup and how the OS was installed (Legacy vs UEFI and etc. can effect how the OS boots). It's a bit tricky especially if you're on modern and very fast hardware the OS boots really quick.
Once you are in GRUB it should look a bit like in the screenshot below (Ubuntu Server 18.04 LTS):
Step #2
In the GRUB boot menu select the Ubuntu entry and hit the E key to enable edit mode for the boot entry.
You will see the following screen:
Navigate to the bottom of the file with the arrow keys until you see the following line:
^ This is an example from a Ubuntu Server 18.04 LTS VPS (might look different on a different machine).
Screenshot:
Change "ro maybe-ubiquity" to "rw init=/bin/bash".
Screenshot:
After that press F10 to boot into single user mode with the new parameters that you've set above.
Step #3
You are now in single user mode and have a direct bash shell session open as the user "root" without the need to enter a password or something else.
Screenshot:
Now simply run the password utility to change the password of the root user:
Enter a new password and confirm it.
Screenshot:
Step #4
Reboot the server or computer to boot into the normal Ubuntu environment using the command below:
Login with your new root password.
That's it! You have recovered or reset your lost root password. The same method can be used to reset other user passwords, too.
In this brief guide I will provide instructions to perform a password recovery on a server or computer with Ubuntu 18.04 LTS or Ubuntu Server 18.04 LTS (it might as well work on older or newer versions). This information can be useful if you have forgot your root password. To perform the necessary steps you need to have VNC access or physical access to your server or computer.
Let's get started.
Step #1
Reboot your server or computer. When it is booting up hit the SHIFT key until you get into the GRUB boo tmenu. You migh need several tries depending on the hardware setup and how the OS was installed (Legacy vs UEFI and etc. can effect how the OS boots). It's a bit tricky especially if you're on modern and very fast hardware the OS boots really quick.
Once you are in GRUB it should look a bit like in the screenshot below (Ubuntu Server 18.04 LTS):
Step #2
In the GRUB boot menu select the Ubuntu entry and hit the E key to enable edit mode for the boot entry.
You will see the following screen:
Navigate to the bottom of the file with the arrow keys until you see the following line:
Code: (Select All)
linux /boot/vmlinuz-4.15.0-112-generic root=[...] ro maybe-ubiquity
Screenshot:
Change "ro maybe-ubiquity" to "rw init=/bin/bash".
Screenshot:
After that press F10 to boot into single user mode with the new parameters that you've set above.
Step #3
You are now in single user mode and have a direct bash shell session open as the user "root" without the need to enter a password or something else.
Screenshot:
Now simply run the password utility to change the password of the root user:
Code: (Select All)
passwd
Enter a new password and confirm it.
Screenshot:
Step #4
Reboot the server or computer to boot into the normal Ubuntu environment using the command below:
Code: (Select All)
exec /sbin/init
Login with your new root password.
That's it! You have recovered or reset your lost root password. The same method can be used to reset other user passwords, too.