Reset Root User Password in CentOS/RHEL 7.x

Reset Root User Password in Linux (CentOS/RHEL 7.x)

Reset Root User Password by following steps :

If linux system is running, reboot the system for reset the password in Centos/rhel 7.x in following command.

#init 6

At the boot menu hit “e” key to edit boot entry, and find the linux16 line in the grub option, and add quotes “rd.break” at the end of this linux16 line.

Press Ctrl+x for boot the system, it will boot initramfs prompt.

Now remount the root file system by following command :

switch_root:/#mount -o remount,rw /sysroot

Change into chroot so /sysroot is used as root of the file system :

switch_root:/#chroot /sysroot

Reset password by following command :

sh-4.2#passwd root

Update SELinux information as following command :

sh-4.2#touch /.autorelabel

Now exit

sh-4.2# exit
switch_root:/# exit

System reboot automatically, Now use new password to login.

you can check our new post click here

Leave a Reply

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