entos7 / rhel7 single-user mode and reset passwords manner changed greatly, GRUB b by the guide into a guiding ctrl + x.
There are major rd.break and reset the password init in two ways.
rd.break method:
1, when activated, the interface is started, the respective start, kernel name by "e";
2, after entering, to find a place linux16 beginning, press "end" key to finally enter rd.break, press ctrl + x to enter;
3, the command input into the mount, to find the root / sysroot /, and not write, only ro = readonly authority;
4, mount -o remount, rw / sysroot /, remount, then mount, have found that r, w authority;
5, chroot / sysroot / change the root;
(1) echo "123" | passwd -stdin root change the root password to 123, or enter the passwd root, interactive modification;
(2) There is a first cp, then modify / etc / shadow file
6, touch /.autorelabel sentence is to take effect selinux
7, ctrl + d exit
8, then reboot
So far, password changes are complete
The second method
init method:
-
Start the system, and the screen display at start GRUB2 press e to enter edit mode.
-
In linux16 / linux / linuxefi add the following parameters where the end of the line: init = / bin / sh, and ro to the RW (Step 4 thus omitted)
-
Press Ctrl + x to boot shell.
-
Mount the file system as writable mode: mount -o remount, rw /
- Run passwd, follow the prompts to change the root password. Or perform echo "123" | passwd root --stdin (123 is the password, you can set yourself)
-
How to enable the system before the selinux, you must run the following command, otherwise the system will not boot properly: touch /.autorelabel (the middle with spaces)
- Run the command exec / sbin / init to start normally.