Root Password Forgot modify the way!

A: Go to the linux kernel:

Linux system boot into the guidance screen, select: CentOS Linux (3.10.0-693.e17.x86_64) 7 (Core), press the letter "E" key to enter the edit mode Linux kernel.

Two: linux kernel were compiled;

After entering the Linux kernel mode, find the line that begins with Linux16 at the end, enter: rd.break, then hold down the Ctrl + x to boot into rescue mode

Three: Enter the code:

switch_root:/#mount  -o  remount   rw  /sysroot

switch_root:/#chroot   /sysroot

sh-4.2 # LANG = C

sh-4.2#passwd

Touch-4.2 # /.autorelabel SH      // make SELinux into effect, if you do not perform, modify the password is not in force.

sh-4.2#exit

switch_root:/#reboot

*** Remember: you need to sh-4.2 # exit mode, you can use the reboot command to restart

Guess you like

Origin www.cnblogs.com/cxm123123form/p/11314415.html