How can I reset my root password?

This article explains how to reset the root password if you no longer know it. You will require KVM access to your server in order to perform these steps.

CentOS/Fedora

  1. Through the KVM, initiate a restart of your server by sending the shutdown command:
  2. When it comes to the Loading CentOS/Fedora Grub Bootloader screen hit esc. (Right after you get to the network boot screen it will be at the grub bootloader screen)
  3. At the grub screen select the default OS & hit e to edit.
  4. Then you should have 3 lines of text. Select the line that starts with kernel & ends in root=label=/
  5. Press e to edit the line, and at the end of the line add a space and then put a capital S.
  6. Then enter to save & go back to the previous screen.
  7. Then hit b for boot with that line selected.
  8. It will enter you in single user mode and you get a bash prompt.
  9. Then you can just type ”’passwd”’ enter new password and reboot.

You will not need to re-edit the grub loader it reverts to normal after the next reboot.

Debian

Reboot and edit the Grub kernel line add a space then the following at the end of the line. (like ‘Alternate Method’ above)

Then run this command to remount the root partition in read/write mode.

and reset the root password as normal with the ‘passwd’ command.

  • 314 Users Found This Useful
Was this answer helpful?

Related Articles

Advantages of ZFS

ZFS as a rather new filesystem offers various advantages in comparison to regular filesystems...

Analysing log files in Windows and Linux

Everyone knows the scenario, you want to analyze an issue of your server or local computer but...

Can i use TUN/TAP ?

Yes our VPS are KVM or Vmware based and you have your own kernel so using TUN/TAP is no problem.

Changing the Windows Administrator password – The easy way

Today we are going to show you how to change your Windows Administrator password the easy...

Command ‘curl’ not found on Ubuntu 20.04

The following error message may appear on your terminal hinting the unavailability of the curl...