How to reset forgotten root password in ubuntu 16/18

How to reset forgotten root password in ubuntu 16/18


Firstly, you need to power on or reboot your Ubuntu system. You should get a grub menu as shown below.

Next, press the 'e' key to edit the grub parameters. This should display a screen as shown below.

Scroll down until you get to the line that begins with 'linux /boot/vmlinuz' the entire line is highlighted below. Narrow down to a section that reads "ro quiet splash $vt_handoff".

Replace “ro ifnames=0 biosdevname=0” with “rw init=/bin/bash” as shown. The purpose is to set the root file system with read and write commands denoted by the rw prefix.

Thereafter, press ctrl + x or F10 to reboot your system. Your system will boot into a root shell screen as shown below. By running the command you can confirm that the root filesystem had access rights to read and write.

mount | grep -w /

The output in the screenshot below confirms read and write access rights denoted by rw.

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.

With the root password successfully changed, reboot into your Ubuntu system by running the command.

exec /sbin/init

Thankyou.

    • Related Articles

    • How to reset forgotten root password in Debian

      In this tutorial, we will learn how to reset a forgotten root password in a Debian system.  So, first power on or reboot Debian system. It should be presented with a GRUB menu as shown below. On the first option, proceed and press the ‘e’ key on the ...
    • How to reset forgotten root password in centos 7/8

      First, reboot or power on your CentOS 8 system. Select the kernel that you want to boot into. Next, press ‘e’ to interrupt the boot process and make changes. Replace the kernel parameter ro with rw and append an extra kernel ...
    • How to Install Xrdp Server (Remote Desktop) on Ubuntu 20.04

      Xrdp is an open-source implementation of the Microsoft Remote Desktop Protocol (RDP) that allows you to control a remote system graphically . In this tutorial, we will learn how to install and configure Xrdp server on Ubuntu 20.04. Installing Desktop ...
    • Deploy Django Applications Using Nginx and uWSGI on Ubuntu 14.04

      Django is a Python Web Platform of high standards that promotes fast development and clean, pragmatic design. A description on using uWSGI and nginx on Ubuntu 14.04 is given in this document. Before You Begin 1. Get acquainted with the starting guide ...
    • Speed Test in Ubuntu server

      Speedtest.net is an online service that allows you to test your broadband connection by downloading a file from a speedtest.net server located near you. This utility allows you to use the command line to access the service. Step 1: Login into the ...