Recover root password for Ubuntu 18.04

Estimated reading time: 1 min

Introduction

In this article, we will learn how to reset the forgotten password of root user account on Ubuntu 18.04 operating system.

Prerequisites

  1. You should have a VPS, Budget Server, or Dedicated Server with Ubuntu 18.04 installed.
  2. You should have access to your Snel client control panel to open a KVM console.

Note: You can not reset the root password using the OpenSSH shell. You must have access to the KVM console of your server to follow along.

Step 1: Open KVM Console

To open a KVM console on for dedicated server or managed dedicated server, please use this article.

To open a KVM console for budget server please use this article.

To open a KVM console for VPS, login to your Snel account and click on your VPS under services.

VPS

Under the VPS service details page, click on Console to open up the KVM console.

Open Console

You should have the KVM console open in a new browser tab.

KVM Console

Step 2: Reboot Machine

While you have your KVM console open, reboot the server to get the GRUB menu.

Dedicated server users: Open the Server Power Control tab from the service details page of the dedicated server. Click the Reboot button to reboot the server.

Reboot Dedicated Server

VPS users: Open the service details page of the VPS and click on the Reboot button.

Reboot VPS

Note: After rebooting your server quickly go to the KVM console as GRUB menu waits only a few seconds before booting OS.

Step 3: Modify Boot Parameters

After rebooting the VM quickly switch to KVM console and keep pressing SHIFT key repeatedly until you see the GRUB screen. You may need to do this very quickly to get the GRUB menu.

Note: If you missed the grub screen, go ahead and reboot your server again.

In GRUB menu, press e to edit the boot parameters.

GRUB Menu

In GRUB edit mode, find the line which starts with linux and has ro quiet splash $vt_handoff at the end of the line.

Replace ro quiet splash $vt_handoff with rw init=/bin/bash as shown in the picture.

Edit GRUB Commands

Once done, press Ctrl-x to boot with changed parameters.

Step 4: Reset Password

Run the clear command to clear the system messages from the terminal.

Run the following command to change the password.

passwd

Change Password

Now, run the command to reboot the server. You may also use snel control panel reboot buttons described in Step 2 to reboot the machine.

exec /sbin/init 6

Conclusion

In this tutorial, we learned how to reset the password of the root user on Ubuntu 18.04 operating system.

Was this article helpful?
Dislike 1
Views: 19724

Reader Interactions

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *