when a simple user forgets its password it is easy to reset or change password by root privilege but what if you forget the root password then you have to know how to reset password in linux. let’s see the topic common all types of linux users
first you have to have physical access or console access to that system as a general rule know that for resseting any password you need console access.so first rebbot the system and in grub menu press e so that you can edit boot up parameters before kernel is loaded.
in grub page you see condditions and after the close statement by fi in the last line look for rhgb quiet and then replace it with rd.break now press ctrl+X to reboot system.
after reboot your root partition is read only so change it with the following command
mount -o remount rw /sysroot chroot /sysroot
enter the new password now by
passwd
you are not done yet as selinux is enabled by default in centos you need to change it before the next boot so type:
touch ./.autorelabeled
exit reboot
after rebooting system log in with the new password and tadaah… you have successfully reset password in linux. 🙂