Linux

Reset root password on CentOS 7

How to reset root password.

Edit boot menu on-the-go

0. reboot the CentOS 7 and press ESC when GRUB menu show up on the screen and press “e”
1. find “ro” on “linux16” section and then change to “rw init=/sysroot/bin/sh”
2. press “CTRL + x” to reboot CentOS to init sh mode and start to reset root password

chroot sysroot

after booting on init sh mode, run this command:

chroot /sysroot

reset root password

passwd root

reinitial selinux

touch /.autorelabel

exit from chroot

exit

reboot CentOS 7

reboot
Hi, I’m Sysadmin.ID

Leave a Reply

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