How to reset root password on CentOS 7


In this article, we will walk you through step by step how to recover the password on your Centos VPS or Centos Dedicated Server.


Step 1: To get started, you need to connect to the virtual machine's KVM.

Reboot the server and Select Option to Edit - "e".

Step 1-reset root password on CentOS 7



Step 2: Next, using the up and down arrows buttons, select the designation ro


Step 2-reset root password on CentOS 7



Step 3: Next, in line Linux 16, replace ro with:


rw init=/sysroot/bin/sh


Step 3-reset root password on CentOS 7



Step 4: Next, press Ctrl+X. After that, run the command that will provide access to the system:


chroot /sysroot


Step 4-reset root password on CentOS 7



Step 5: Recover root password using the command passwd root


passwd root


After this command you need to enter the new password twice

Step 5-reset root password on CentOS 7



Step 6: Update selinux information touch /.autorelabel


Step 6-reset root password on CentOS 7



Step 7: Exiting Chroot using command exit


Step 8: The last step will be to reboot your system using the command below: reboot


Let’s Wrap Up


Using the simple steps we have described above, you can easily reset the root password on your Dedicated server Centos or VPS Centos.