Thursday, 16 February 2017

Reset Root Password On CentOS 7

Change the root password on CentOS 7 Servers

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 command,
chroot /sysroot

Run the commands to change the root password,
passwd root

After creating the password, run the commands below to update SELinux parameters
touch /.autorelabel

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