Introduction
In this article, we will learn how to reset the forgotten password of root user account on CentOS 6 operating system.
Prerequisites
- You should have a VPS, Budget server, or Dedicated server with CentOS 6 installed.
- 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.
Under the VPS service details page, click on Console
to open up the KVM console.
You should have the KVM console open in a new browser tab.
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.
VPS users: Open the service details page of the VPS and click on the Reboot
button.
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.
This will open the GRUB menu for you.
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:
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.
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.
Does your server boot correctly if you don't change anything on the boot prompt? For these instructions to work it's essential your filesystems are correct and your server functions correctly.