ubuntu How to Reset Forgotten Root Password in Ubuntu

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
Ubuntu Grub Menu

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

Grub Boot Parameters
Grub Boot Parameters

Scroll down until you get to the line that begins with 'linux /boot/vmlinuz' the entire line is highlighted below.

Find Grub Boot Parameter
Find Grub Boot Parameter

Narrow down to a section that reads "ro quiet splash $vt_handoff".

Locate Grub Boot Parameter
Locate Grub Boot Parameter
 

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
Enable Root Filesystem

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
Confirm Root Filesytem Permissions

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
Reset Root Password in Ubuntu

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

# exec /sbin/init

Thank you for coming this far. We hope that you can now comfortably reset the forgotten root password on your Ubuntu system from the grub menu.

 

 

0 (0)
Article Rating (No Votes)
Rate this article
Attachments
There are no attachments for this article.
Comments
There are no comments for this article. Be the first to post a comment.
Full Name
Email Address
Security Code Security Code
Related Articles RSS Feed
YUM CRON Enabling automatic updates in Centos 7 and RHEL 7
Viewed 11657 times since Fri, Oct 26, 2018
KONTO SFTP Z CHROOTEM Z UŻYCIEM OPENSSH-SERVER NA CENTOS/RHEL6
Viewed 1553 times since Fri, Nov 30, 2018
Df command in Linux not updating actual diskspace, wrong data
Viewed 2573 times since Wed, May 30, 2018
Prosty skaner portów TCP w bash
Viewed 2965 times since Thu, May 24, 2018
What UUIDs can do for you
Viewed 1555 times since Tue, Jul 17, 2018
RHEL: Scan and configure new SAN (fibre channel) LUNs
Viewed 7502 times since Sun, May 27, 2018
Use inotify-tools on CentOS 7 or RHEL 7 to watch files and directories for events
Viewed 13540 times since Fri, Jul 27, 2018
logrotate How log rotation works with logrotate
Viewed 8573 times since Sun, Jan 12, 2020
10 Linux cryptsetup Examples for LUKS Key Management (How to Add, Remove, Change, Reset LUKS encryption Key)
Viewed 4818 times since Tue, Jul 31, 2018
Securing /tmp and shm partitions
Viewed 2900 times since Fri, May 15, 2020