How to reset ROOT password in RHEL/CentOS

Hello Linux-Fanatics, this tutorial is about resetting forgotten ROOT password. We all must have faced a situation where we or some other user has forgotten his root password, so how do we reset the password. This is also a question we have to solve while appearing for our RHCSA certifications.

Well, the process to reset the root password is quite simple. So, let’s get started,

Resetting ROOT password

Firstly , reboot your system & when the kernel selection screen comes, press ‘e’ to edit kernel parameter

Next, search for the line starting with “linux16” and move to the end of that line by pressing “end ” key of keyboard. Type ‘rd.break’ without quotes at the end of the line & press “CTRL + X

Now, mount your filesystem in read-write mode as by default its in read-ony mode. To mount filesystem in read-write type “mount -o remount,rw /sysroot” & than type “chroot /sysroot” to make changes to filesystem

Once above steps are completed , we can type “passwd” command & can reset our password.

Now, type “exit” & than “reboot” to reboot he system.

This was tutorial on resetting your password for root. If you have any queries, please mention them below in comment box & I will get back to you 

Leave a Reply