Enter the single user status in centos7 to change the root password
I recently started to learn about linux. As a newbie, I want to write a blog to record my learning experience and count it as a note. I encourage you to not talk much about it. The init method is described here.
Step 1: press the keyboard to go to the following menu
Step 2: select the first item and press the e key to modify it (at the boot option)
Step 3: Find ro,
Step 4: Change ro to rw init =/bin/sh
Step 5: As shown in, delete the rhgb quiet in the last and second rows of this Section, press Ctrl + X to save and start the system.
Step 6: Change the root password
# Passwd root # change the password, and then prompt to enter a new password and confirm the password again
# Touch/. autorelabel # It is said that selinux updated the label after restarting
# Exec/sbin/init # Start the init process normally
Note: If you perform the above command line operations in Chinese mode, garbled characters may occur. The solution is as follows:
$ Echo $ LANG (display the current language) (the first dollar sign is a system symbol and does not need to be edited by yourself. It is # under root permission #)
$ LANG = en_US (English, Chinese: zh_CN)
$ Echo $ LANG (if you execute the first command again, it will show that you are using en_US, indicating English), OK, success