Recover root password for CentOS 6

Estimated reading time: 1 min

Introduction

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

Prerequisites

  1. You should have a VPS, Budget server, or Dedicated server with CentOS 6 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.

Console

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

qemu

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 the OS.

Step 3: Modify Boot Parameters

On KVM console, press any key to interrupt boot when you see this booting message as shown in the picture.

Booting CentOS 6

This will open the GRUB menu for you.

CentOS 6 GRUB

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

In the GRUB menu, press a to modify kernel argument. On kernel argument edit screen, just append a whitespace followed by 1 after rhgb quite as shown in the picture:

Editing Kernal argumnets

Once done, press the Enter key to boot with modified command.

Step 4: Reset Password

Once the system boots up, it will open the bash shell as root user without requiring any password. Reset the password by running the command:

passwd

Reboot the server by running the reboot command.

Conclusion

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

Was this article helpful?
Dislike 0
Views: 9845

Reader Interactions

Comments

  1. Wayne says

    This didn't work for me. During reboot I got these messages (with [OK] to the right):
    . . .
    Remounting root filesystem in read/write mode:
    Mounting local filesystems:
    Enabling /etc/fstab swaps:
    Entering non-interactive startup
    Starting monitoring for VG vg_centos6: 2 logical volume(s) in volume group "vg_centos6" monitored
    Retrigger failed udev events

    {. . . . at this point the boot screen rolls, then prints the following}

    Telling INIT to go to single user mode
    Give root password for maintenance
    (or type Control-D to continue):

    The above prompt wants the root password, which (of course) I have forgotten.

Leave a Reply

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