REDHAT7 uses GRUB2, which differs from Redhat6.x's approach to single-user access.
First, the Init method
1, Centos7 GRUB2 interface will have two entrances, normal system entrance and rescue mode;
2. Modify GRUB2 Boot
Press "E" on the normal system entrance, will enter the edit mode, search for the RO line, start with linux16;
Change RO to RW; (read-only change to writable)
Remove RHGB quiet (quiet mode no code line swish go, can delete)
Add init=/bin/sh; (or init=/bin/bash, specify shell environment)
Press Ctrl+x to start the system.
3. Change the root password
#passwd #修改密码
#touch/.autorelabel #据说是selinux在重启后更新label
#exec/sbin/init #正常启动init进程
Second, Rd.break method
1, start the time, in the Start screen, the corresponding startup item, the kernel name on the "E";
2, enter, find linux16 beginning place, press "End" key to the last, enter Rd.break, press ctrl+x enter;
650) this.width=650; "Style=" border-right-0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/7F/CE/ Wkiom1ctpeqj1sjhaaauhjgxuxs508.png "width=" 244 "height=" "/>"
3, enter after the command mount, found root for/sysroot/, and can not write, only ro=readonly permission;
650) this.width=650; "Style=" border-right-0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/7F/CC/ Wkiol1ctpsttojvhaaasymyf3y8204.png "width=" 244 "height="/>
4, Mount-o remount,rw/sysroot/, re-mount, after Mount, found R,W permission;
650) this.width=650; "Style=" border-right-0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/7F/CC/ Wkiol1ctpsbbhltxaaath9i_6ro790.png "width=" 244 "height="/>
5, chroot/sysroot/change the root;
650) this.width=650; "Style=" border-right-0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/7F/CC/ Wkiol1ctpsewkwgzaaaxhft0io4662.png "width=" 244 "height="/>
The prompt becomes sh-4.2#
(1) Echo Redhat|passwd–stdin root change root password for redhat, or input passwd, interactive modification;
650) this.width=650; "Style=" border-right-0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/7F/CC/ Wkiol1ctpsixaop-aaami7yvr9c296.png "width=" 244 "height="/>
650) this.width=650; "Style=" border-right-0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/7F/CC/ Wkiol1ctpsmbco49aaay6ws6k1g049.png "width=" 244 "height="/>
(2) There is a CP first copy, and then modify the/etc/shadow file
650) this.width=650; "Style=" border-right-0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/7F/CC/ Wkiol1ctpsqbipysaaavsf_4e0u991.png "width=" 244 "height=" "/>
Online said for SELinux to take effect also need to implement #touch/.autorelabel, measured found not to execute this sentence can also.
6, Ctrl+d exit chroot status.
7. Then execute the #reboot command to restart the server.
REDHAT7 Single-User mode change Password