Change the root password on CentOS 7

By | 2020-07-14

I stumbled across this today, and it worked. I haven’t tested it on v8, though. Maybe give it a shot on v8 and let me know in the comments?

At the boot menu, press e to edit the existing kernel (Core).

Scroll down to the list until you see the line ro,change ro to rw and start into a bash shell. It should look like rw init=/sysroot/bin/sh.

Press Ctrl + X to start into single user mode.

In the single user mode run the commands:

chroot /sysroot
passwd root
touch /.autorelabel

Exit and reboot your system. You should be able to sign on and use the system with the new password.

Author: dwirch

Derek Wirch is a seasoned IT professional with an impressive career dating back to 1986. He brings a wealth of knowledge and hands-on experience that is invaluable to those embarking on their journey in the tech industry.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.