Reset root password in CentOS 7/rhel 7

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.