All HowTo's Cybersecurity Linux Redhat, Fedora and CentOS Linux

Reset the root password in CentOS/Redhat 7

The process to reset the root password when you’ve forgotten it has changed in version 7 of Redhat and CentOS Linux.

First you need to reboot and temporarily edit the Grub2 boot loader. Add the following to the end of the line starting with “Linux16”:

rd.break enforcing=0

Boot using your changes by pressing:

Control+x

The changes you’ve just made are not permanent.

Once booted, issue the following:

mount -o remount,rw /sysroot
chroot /sysroot
passwd 

Enter your new password twice (as requested) and finish the process with the following:

touch /.autorelabel
Control+Alt+Del

The system will reboot and you’ll be able to log in.

Leave a Reply

Your email address will not be published. Required fields are marked *