How To Reset Root Password in Ubuntu
This tutorial includes two ways with the steps to reset our root password on Ubuntu quickly.
For this tutorial, we will use Ubuntu 16.04.
Reset Root Password Using Recovery Mode in Ubuntu
By default, the boot manager in Ubuntu or GRUB includes the recovery mode functionality which allows us to perform multiple management tasks from the console.
To access to this mode, it will be necessary to restart Ubuntu and during startup, press the Esc key. We will access the following window where we select the line that includes (recovery mode):
Once chosen this option we go to the root with Drop to root Shell prompt:
Once we press Enter, we can execute the following syntax from the console to reset the password of the respective user. Later we enter the corresponding password and restart the system to apply the changes.
Reset Root Password Manually in Ubuntu
This option applies when our GRUB does not have the recovery mode option enabled.
For this we must restart the system again and press the Esc key, in the expanded window we select the kernel option with the generic line:
Once this line is selected we press the E key to edit the active orders, and we will see the following:
There we must locate the line where the boot kernel is found and where we have the text ro quiet splash, and we will add the following:
Press F10 or the Ctrl + X keys to start the system with the new change and we will see the following:
We can see, we have accessed as root users the console line where we will execute the following:
Then, establish the corresponding password and finally run the following commands:
sync reboot –f
With these steps, you can change that root password in Ubuntu so that if you forget, we will have the possibility to change it and access the computer.