How to reset root password on CentOS 7

First, reboot or power on your CentOS 7 system. Next, press ‘e’ on the keyboard to interrupt the boot process to make changes.

After pressing “e“, scroll down to linux16 line and add rd.break parameter at the end of line. The Linux16 line will be linuxefi on the UEFI system.

Now, press Ctrl+x to boot with changed parameters. rd.break breaks the boot process at initramfs.

Once the system boots up the switch_root prompt will appear.
Remount the read-only file system to read & write permission by below command :

mount -o remount,rw /sysroot

Change shell to file-system’s root by below command :

chroot /sysroot

This will change the shell to sh-4.x.
Now, change the root password.

Now run exit command twice to Reboot the server .

Thank you for reading this article.

Was this helpful?

1 / 0

Leave a Reply 3

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


gVsEeLiArbChDkSm

gVsEeLiArbChDkSm

It was very helpful for me!

JeHYZnTclywi

JeHYZnTclywi

Thank you!

zovroptor

zovroptor

Simply wanna input that you have a very nice site, I like the style and design it really stands out.