Linux operating system --------- modify password command or repair grub

The steps to modify the password are as follows:

  1. Load the CD, select in the CD boot interface ----- troubleshooting
  2. Enter the troubleshooting menu and select -----Rescue a centos system
  3. To enter the guide, you can press enter, or wait to press 1 and press enter to enter sh-4.2#
  4. Cut the root after entering rescue mode:
chroot /mnt/sysimage/
  1. change Password:
 passwd root
输入密码:123123					##  1次
输入密码:123123   				##  2次
  1. Restart:
exit
reboot
  1. verification:
  • Login: root
  • Password: 123123

Just complete a simple password change operation

Repair CD files

  1. Load the CD, select in the CD boot interface-----troubleshooting
  2. Enter the troubleshooting menu, select ----- Rescue a centos system
  3. To enter the guide, you can press enter, or wait to press 1 and press enter to enter sh-4.2#
  4. Cut the root after entering rescue mode:
 chroot /mnt/sysimage/
  1. Use the grub2-install command to repair grub-----------------------------###It is not good to use the 7 and 8 commands
grub2-install /dev/sda
  1. Check if it is repaired:
cd /boot/grub2/
  1. Use the grub.cfg configuration file:
grub2-mkconfig -o /boot/grub2/grub.cfg
  1. Check if it is repaired:
cd /boot/grub2/
  1. Restart:
exit
reboot 

Finish changing the hard disk to the priority startup item

Guess you like

Origin blog.csdn.net/weixin_48190875/article/details/107469930