How to reset password in linux

Publish : 2022 Aug 04 1375 view Cat : AVANETCO + Linux
reset password in linux
5/5 - (2 votes)
In the previous post we covered how to change password in linux but what do we do when we have forgotten the current root password in this post we will see how to reset password in linux.

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.

reset password in linux

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. 🙂