1./ Step
Start the system and, on the GRUB 2 boot screen, press the e key for edit
2./ Step
Jump to the end, of the linux16 line, or linuxefi on UEFI systems and add rd.break and finally press Ctrl + x
3./ Step
Remount the file system as writable using the floowing command
switch_root:/# mount -o remount,rw /sysroot
4./ Step
Change the file system’s root using the following command
switch_root:/# chroot /sysroot
5./ Step
Use now the following command to change the root password
sh-4.2# echo "Your_new_password" | passwd --stdin root
6./ Step
To make sure that selinux context of file /etc/shadow is restored properly after reboot, run:
sh-4.2# touch /.autorelabel
7./ Step
Remount the file system as read only
sh-4.2# mount -o remount,ro /
8./ Step
Enter exit twice to reboot
PS. If you like this post please share it with your friends on the social networks using the buttons below.Thanks.