In this article, we will learn how to reset the forgotten password of root user account on CentOS 7 operating system.
- You should have a VPS, Budget Server, or Dedicated Server with CentOS 7 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
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
e when you see this GRUB screen as shown in the picture.
This will open an editor for you to edit the boot commands.
Note: If you missed the grub screen, go ahead and reboot your server again.
Once you are in edit mode, add
rd.break enforcing=0 at the end of the line starting with
linux16 as shown in the picture.
Once done, press
Ctrl-x to boot with changed parameters.
rd.break breaks the boot process at
enforcing=0 disables the SELinux.
Step 4: Reset Password
Once the system boots up with the modified command, the
switch_root prompt will appear.
Remount the read-only file system
/sysroot in write mode by running the following command.
mount -o remount,rw /sysroot
Change shell to file-system’s root by running:
This will change the shell to
Now, you can change the root password by running the following command.
Once done, exit to
switch_root prompt by running:
Reboot the server by running the
In this tutorial, we learned how to reset the password of the root user on CentOS 7 operating system.