What if CentOS7.2 forgets the root password?
This article will explain in detail how CentOS7.2 forgets the root password for you. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.
The way the CentOS 7 root password is reset is completely different from that of CentOS 6. Take changing the root password in single-user mode as an example.
1. Reboot, press esc, press e on the first line to edit
two。 Edit and modify two things: change ro to rw, and add init=/bin/sh after LANG=en_US.UFT-8
3. Press Ctrl+X to restart and change the password
4. Since selinux is open, you need to execute the following command to update the system information, otherwise the password will not take effect after reboot.
Our department shuts down selinux
# vi / etc/sysconfig/selinux
5. Restart the system
# exec / sbin/init
Add: let's take a look at how to reset the CentOS 7.2 ROOT password
Description:
This document has been successfully tested on CentOS 7.2kernel version 3.10.0 system.
-
First milestone-Select the edit option in the launch GRUB menu and press "e" to enter the edit
Second milestone-find "ro" around line 16 and change "ro" to "rw init=/sysroot/bin/bash"
Third milestone-press "ctrl + x" at the same time to enter single-user mode
The fourth milestone-- enter the system with the "chroot / sysroot" command
Fifth milestone-- "passwd root" reset root password
The sixth milestone-- updating SELinux information with "touch / .autorelabel"
Seventh milestone-enter "exit" to exit chroot
Eighth milestone-restart your system with "reboot-f"
Ninth milestone-- Landing system Test
This is the end of the article on "how CentOS7.2 forgets the root password". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.