How to reset lost root password on Ubuntu 18.04 Bionic Beaver Linux

1 Reset forgotten password with sudo user

If you can login sudo user, you can use sudo for resetting forgotten password.

$ sudo passwd <username>

2 Reset forgotten password with root user on recovery mode

If you cannot login sudo user because sudo user’s password is forgotten, you can use root user on recovery mode.

Press SHIFT key for showing GRUB menu.

Select “Advanced options for Ubuntu”.

0001_AdvancedOptionsForUbuntu.png

Select kernel which has “recovery mode” suffix.

0002_recovery-mode.png

Select “root”.

0003_recovery-mode-root.png

After remounting root file system with rw, you can reset forgotten password.

Press Enter for maintenance
(or press Control-D to continue):
# mount -o remount,rw /
# passwd <username>
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
# reboot