RESET forgotten password in CENTOS 7


How to reset forgotten password on CENTOS 7 Servers.

In the boot Menu - choose existing kernel (Core) as shown below, then press "e" to edit.



Change the ro line to rw and add init=/sysroot/bin/sh;


It should look like this

rw init=/sysroot/bin/sh



After changing that, press Control + X or Ctrl + X on your keyboard to start into single user mode using the bash shell speciꜘed above. In this mode, we’re going to change the root password.

In the single user mode, run the command as shown below;

chroot /sysroot

Finally, run the commands below to change the root password.

Then you'll be prompted to set a new password and confirm it.

After creating the password, run the commands below to update SELinux parameters;

touch /.autorelabel

Exit and reboot the Linux system.

You'll be able to login with your new centos root password.



Thanks.
- JN

Comments

Popular Posts