Get the App
SLTechnology News&Howtos  ›  Network Security  › 

Chapter 10 linux Emergency troubleshooting-centos7.5 knowledge

Shulou Source: shulou.com Published: 2022-06-01 04:50:08 10月04日 Update

Centos7 forgot the root password

On the LINUX kernel option, press e on the first item, find the linux16 line, and finally add rd.break;ctrl+x, and then

Mount-o remount,rw / sysroot

Chroot / sysroot

Passwd-d root

Touch /. Autorelabel

Exit

Exit

Then change the password.

Or other means.

2. Set the password by GRUB

1. Modify / etc/grub.d/00_header and add: at the end of the file:

# admin grub,append by jason.wang 20181105

Cat insmod xfs

Grub > set root= (hd0,msdos1) (- > this is the boot partition you found in the previous step)

Grub > linux16 / vmlinuz-xxxxx root=/dev/mapper/centos-root

Grub > initrd16 / initramfs-.xxxxx.img

Grub > boot

If there is no problem, the system will boot normally at this time.

Repair grub

The above has entered the system, you can view the / boot/grub2/grub.cfg file at this time, it should be empty. You can fix grub with the following command.

Sudo grub2-mkconfig-o / boot/grub2/grub.cfg

Sometimes the Windows system is recognized using the sudo grub2-mkconfig command, but the configuration file / boot/grub2/grub.cfg for grub2 is not updated. Then add one more parameter-o

After the operation is complete, you can restart the confirmation.

Assignment:

1. Two ways to operate GRUB plus password

2. The solution for Centos7.5 to forget the password.

Tags: Password command file system configuration kernel parameter time step generation message goodbye method can be passed number uppercase that is manual effect method Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB macOS Linux Shulou Tech Info Huawei