650) this.width=650; "class=" AlignCenter size-full wp-image-7111 "src=" http://www.itzgeek.com/wp-content/uploads/ 2014/07/centos-7.jpg "alt=" CentOS 7 "width=" 183 "height=" "style=" margin:0px auto;padding:0px;border:0px; vertical-align:baseline;height:auto;clear:both;background-position:0px 50%; "/>
There may is some occasion you'll end up with requirement to reset the root password, the occasion comes when you forget root password; Follow this guide to reset the password of root. In CentOS, single user mode would help us to achieve our goal of resetting root password.
Boot your system in single user mode.
chroot Your system
< Pre class= "dos" style= "border:1px solid rgb (227,227,227); Vertical-align:baseline;background-color:rgb (252,252,252) ; margin-top:0px;margin-bottom:0px;padding:10px;font-size:12px;width:auto;float:none;clear:none;line-height : 16px; " >chroot /sysroot |
reset the root password.
< Pre class= "dos" style= "border:1px solid rgb (227,227,227); Vertical-align:baseline;background-color:rgb (252,252,252) ; margin-top:0px;margin-bottom:0px;padding:10px;font-size:12px;width:auto;float:none;clear:none;line-height : 16px; " >PASSWD |
update SELinux information.
< Pre class= "dos" style= "border:1px solid rgb (227,227,227); Vertical-align:baseline;background-color:rgb (252,252,252) ; margin-top:0px;margin-bottom:0px;padding:10px;font-size:12px;width:auto;float:none;clear:none;line-height : 16px; " >touch /.autorelabel |
exit chroot
< Pre class= "dos" style= "border:1px solid rgb (227,227,227); Vertical-align:baseline;background-color:rgb (252,252,252) ; margin-top:0px;margin-bottom:0px;padding:10px;font-size:12px;width:auto;float:none;clear:none;line-height : 16px; " >exit |
reboot your system.
< Pre class= "dos" style= "border:1px solid rgb (227,227,227); Vertical-align:baseline;background-color:rgb (252,252,252) ; margin-top:0px;margin-bottom:0px;padding:10px;font-size:12px;width:auto;float:none;clear:none;line-height : 16px; " >reboot |
Login with new password.
That's all.
This article from "Vincent" blog, declined reprint!
Reset root password in CentOS 7/rhel 7