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

Example Analysis of missing grub.conf and forgetting root password

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the missing grub.conf and forget the root password example analysis, the content is very detailed, interested friends can refer to, hope to be helpful to you.

Lab 1: remedial measures after deleting / boot/grub/grub.conf

After the system is rebooted, enter the following interface:

The grub > cursor flashes here all the time, and we make the following command:

Grub > root (hd0,0)

Grub > kernel / vmlinuz-2.6.18-164.el5 ro root=LABEL=/ the result of my experiment here is that grub > kernel / boot/vmlinuz-2.6.18-164.el5 ro root=LABEL=/ can't find the kernel file. I don't know why.

Grub > initrd / initrd-version.img here should be grub > initrd / boot/initrd-version.img

Grub > boot

Make up / boot/grub/grub.conf after entering, and then

[root@redhat grub] # sync

[root@redhat grub] # sync

[root@redhat grub] # reboot

It's kind of settled.

Tell me why mine is to add / boot, because my original grub.conf is like / boot/, not / like this. As for how I pretend to be like this, I am also very surprised, many of my machines are installed directly / like this, this is a mystery.

Lab 2: forget the root password

Enter in the interface of selecting the kernel, then press e after selecting the kernel to enter the editing page of the kernel, then press e and select kernel, write single, then press b enter to enter single user mode, and then use passwd root to change the root password. Then restart after sync.

[root@redhat ~] # vi / etc/grub.conf

Lrwxrwxrwx 1 root root 22 Jul 19 22:02 / etc/grub.conf->.. / boot/grub/grub.conf

[root@redhat ~] # grub-md5-crypt

Password:

Retype password:

$1 $Iu36g/$X6a/WI5EcRN1MUilyfQvA1

[root@redhat ~] # vi / etc/grub.conf write: password-- md5 $1 $Iu36g/$X6a/WI5EcRN1MUilyfQvA1

[root@redhat ~] # sync

[root@redhat ~] # reboot

So you have to enter your grub password to enter single-user mode.

Tell me what to do if you forget the grub password as well as the root password. (if this person really forgets these two passwords, for a real operator, this person is unqualified, and this person is miserable.)

Boot from the CD, then enter the rescue mode linux resuce, and then the system on the hard disk will be mounted to / mnt/sysp_w_picpath, then enter / mnt/sysp_w_picpath/boot/grub/ to delete the password line in grub.conf, and then type the command sync, otherwise it will be changed for a long time. And then reboot. Finish the job!

This is the end of the sample analysis of missing grub.conf and forgetting root password. I hope the above content can be helpful to you and learn more. If you think the article is good, you can share it for more people to see.

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

Servers

Wechat

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

12
Report