Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Chapter 10 linux Emergency troubleshooting-centos7.5 knowledge

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report