Root password recovery in CentOS

Submitted on Sun, 07/06/2025 - 09:12

Tags

Find the line that starts with:

linux16 /vmlinuz...


At the end of that line, add the following:

rd.break


Press Ctrl + X

 

Remount the Filesystem as Read/Write

mount -o remount,rw /sysroot


Chroot into the Real System

chroot /sysroot


Change the Root Password

passwd

 

Re-label SELinux Contexts (important)

touch /.autorelabel


exit and reboot