Statistics say that almost 25% of people usually forget their computer’s password within 14 days after a clean OS installation. So don’t panic if you can’t remember the root password of your Ubuntu Linux. Moreover, if you are a Linux system administrator, very often, you may get the forgotten password issue from your clients. Resetting the forgotten root password in Ubuntu Linux is not unethical when you need to enter the system. But of course, that doesn’t give you the right to break every computer and look inside the system. You can reset the root password of a Ubuntu Linux system without knowing the current password.
Resetting Password in Ubuntu Linux
In Ubuntu, the system’s root password is written inside the root directory of the Linux filesystem. The root password is essential because you can not log in inside the system without the password. Even, you can not assign any administrative tasks without knowing the root password. In this post, we will see how to reset the forgotten root password in Ubuntu Linux.
Step 1: Enter into Recovery Mode in Ubuntu Linux
To reset the Ubuntu root password, you need to restart your machine and go to the GNU GRand Unified Bootloader (GRUB) menu. You may need to find the boot menu hotkey for your system. Once the boot menu is opened, select “Advanced options for Ubuntu” and hit the Enter button. If you can’t find the boot menu from your system, make sure that the appropriate bootloader option is enabled from your BIOS settings.
In this step, a new window will open, and you will see some drop-down menu for the recovery option. Select the generic recovery mode. In my case, I am selecting the “Ubuntu, with Linux 5.4.0-40- generic (recovery mode)“. You may notice that there are two options to reach the recovery mode. You can choose only one option according to your Linux kernel and direct-access storage device (DASD) version.
Step 2: Access the
root Directory of Ubuntu Linux Filesystem
After entering the recovery mode, some system checkups will happen. Then you will be able to see the recovery menu of your Ubuntu Linux. I should remind you that in recovery mode, you will get the read-only permission of the filesystem. But no worries, later we will see how to enable both read-write permissions.
Now, as we are going to reset the root password of our Ubuntu Linux system, so we have to select the root menu from the drop-down menu. Use the keyboard arrow keys to reach the root menu. Selecting the root menu will let us use a shell prompt. We will use the shell commands to reset our Ubuntu Linux password.
Step 3: Recover Root Password in Ubuntu Linux
As we have got access to the shell command, now we can reset the Ubuntu root password through the command shell. Press the Enter button to continue the password resetting process. Now we have to mount, remount, and enable the read-write permission for the root filesystem.
After mounting the root filesystem, we will now type the password recovery command following by the system username. Here, my username is
ubuntupit, you have to use your username. Then we will get an option to enter a new password. After entering the new password, retype the password for security purposes.
If everything is done successfully, you will be able to see a message saying: “Password updated successfully.” There you go! The process of resetting the root password of your Ubuntu Linux is done. Now, reboot your system to continue.
~# mount -n -o remount,rw / ~# passwd ubuntupit New password: Retype new password: passwd: password updated successfully ~# reboot
When you forget the root password of your Ubuntu Linux, you may think of deleting the operating system from your system and reinstalling the entire system. But why would you do that while you know the method of resetting the root password in Ubuntu Linux? In this post, I have covered the concept of where the root password is stored and how to reset the root password successfully in Ubuntu Linux through the recovery mode.
For the newcomers, Ubuntu is a very adaptable distro of Linux. You can apply much theoretical knowledge on Ubuntu to get the pragmatic thrill of Linux. If you find this post useful and convenient, please share this post on your social media. Also, you can write any observations regarding this post in the comment section.