Lab environment:
1,RootHow to recover password loss
Start the instance, press any key to enter GRUB mode, and press "e" to edit GRUB.
Select the kernel part of the second line and press "e" to enter the editing mode.
Enter sulinux = 0 1 and press enter to save, and then press "B" to continuously activate the init 1 mode (Note: sulinux = 0 means temporarily changing sulinux to permissive mode, RHEL6, the default sulinux policy is in enforcing mode. You can also use "setenforce 0" in init1 mode to temporarily change it to permissive mode, or change/etc/sysconfig/selinux to change SELINUX = enforcing to SELINUX = permissive to change selinux mode to permissive Warning mode. If you want to change to disabled, you must restart the mode to make the change take effect.
Start the reboot and enter init 1 mode.
Use the passwd command to change the password
2,IfGRUBEncryption to prevent others fromGRUBModify
Generate the grub ciphertext key using the grub-md5-crypt command
Modify the grub. conf file and add the "password-md5 key" before the title. This method is used to add the ciphertext. plaintext. This method is not safe and will rarely be used. After modification, restart.
After restarting, press any key to enter GRUB mode. You will find that "e" mode is not available. Press "p" to enter the password.
Note: When modifying/etc/grub. conf, the "password-md5 key" must be added before the title. Let's see what happens after the key is added:
New Technical blog address: www.rsyslog.orgWelcome to visit!
Save the modification and restart the system. You can enter the GRUB Password before entering the system, if your company's servers are hosted outside, it will be troublesome! If you don't tell people the GRUB Password, they won't restart you.
New Technical blog address: www.rsyslog.orgWelcome to visit!
This article is from the blog "minino's Linux open-source technology blog ".