How to reset Root user password from boot on centos 7
To reset root password from boot on centos 7
The way to reset the root password on centos7 is totally different to Centos 6. Let me show you how to reset root password in CentOS 7.
While turning on the power button, at the grub boot menu press the “ e” key to edit the first boot entry
From the grub options, go to the line that starts with “ linux16”
you have to go the end of the line and type “ rd.break” and then press ctrl+x
Now the initrampfs prompt with a root shell will appear at this stage, the root file system is mounted in read only mode to /sysroot and it must be remounted with read/write (rw) permission, so enter “ mount &ndash o remount,rw /sysroot”
once the file system is remounted , change it to chroot jail so that /sysroot is used as the root of the file system.this can be done by running “ chroot /sysroot”
From here the root password can be reset with “ passwd” command.
Now we can reboot but, as centos 7 uses SELINUX enforcing mode by default we have to fix the context of the /etc/shadow file so create “ touch /.autorelabel”
Creating this file automatically perform a relabel of all files on next boot
Type “ exit” twice and machine will reboot, once the reboot is complete the root account will set with a newly set password.
Now the machine will reboot and the login screen appears ,
login using a root user with changed password
with this, the method to reset root password from boot on centos 7 comes to an end.
Comments ( 0 )
No comments available