In this article, you will learn how to reset the forgotten root password on Ubuntu 18.04 LTS and Ubuntu 20.04 LTS.
Firstly, you need to either power on or reboot your Ubuntu system. You should get a grub menu as shown below. If you are running your system on VirtualBox, press the ‘SHIFT’ key on the keyboard to bring up the boot menu.
![Ubuntu Grub Menu](https://www.tecmint.com/wp-content/uploads/2020/04/Ubuntu-Grub-Menu.png)
Next, press the 'e'
key to edit the grub parameters. This should display a screen as shown below.
![Grub Boot Parameters](https://www.tecmint.com/wp-content/uploads/2020/04/Grub-Boot-Parameters.png)
Scroll down until you get to the line that begins with 'linux /boot/vmlinuz'
the entire line is highlighted below.
![Find Grub Boot Parameter](https://www.tecmint.com/wp-content/uploads/2020/04/Find-Grub-Boot-Parameter.jpg)
Narrow down to a section that reads "ro quiet splash $vt_handoff"
.
![Locate Grub Boot Parameter](https://www.tecmint.com/wp-content/uploads/2020/04/Locate-Grub-Boot-Parameter.jpg)
Replace "ro quiet splash $vt_handoff"
with rw init=/bin/bash
as shown. The aim is to set the root file system with read and write commands denoted by the rw
prefix.
![Enable Root Filesystem](https://www.tecmint.com/wp-content/uploads/2020/04/Enable-Root-Filesystem.jpg)
Thereafter, press ctrl + x
or F10
to reboot your system. Your system will boot into a root shell screen as shown below. You can confirm that the root filesystem had read and write access rights by running the command.
# mount | grep -w /
The output in the screenshot below confirms read and write access rights denoted by rw
.
![Confirm Root Filesytem Permissions](https://www.tecmint.com/wp-content/uploads/2020/04/Confirm-Root-Filesytem-Permissions.png)
To reset the root password execute the command.
# passwd
Provide a new password and confirm it. Thereafter, you will get a ‘password updated successfully’ notification.
![Reset Root Password in Ubuntu](https://www.tecmint.com/wp-content/uploads/2020/04/Reset-Root-Password-in-Ubuntu.jpg)
With the root password successfully changed, reboot into your Ubuntu system by running the command.
# exec /sbin/init