Centos7/rhel7 into the single user mode and reset password mode has changed significantly, grub from B to boot into ctrl+x boot.
There are two ways to reset passwords, Rd.break and init.
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;
3, enter after the command mount, found root for/sysroot/, and can not write, only ro=readonly permission;
4, Mount-o remount,rw/sysroot/, re-mount, after Mount, found R,W permission;
5, chroot/sysroot/change the root;
(1) Echo Redhat|passwd–stdin root change root password for redhat, or input passwd, interactive modification;
(2) There is a CP first copy, and then modify the/etc/shadow file
6, Touch/.autorelabel This sentence is for SELinux to take effect
7, Ctrl+d exit
8. Then reboot
At this point, the password modification is complete
Init method:
1. Start the system
, and when GRUB2 starts the screen display, press the E key to enter edit mode.
2. Add the following at the end of the Linux16/linux/linuxefi parameter line: init=/bin/sh
3. Press Ctrl+x to boot to the shell.
4. Mount file system to writable mode: Mount–o REMOUNT,RW/
5. Run passwd and follow the prompts to change the root password. 6. How to enable SELinux before the system, you must run the following command, or the system will not start normally: Touch/.autorelabel
7. Run the command exec/sbin/init to start normally, or restart with the command exec/sbin/reboot
Linux two ways rd.break and init reset the root administrator password