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

How to modify the GRUB menu Startup item by CentOS

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly explains the "CentOS how to modify the GRUB menu startup items", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "CentOS how to modify the GRUB menu startup items" bar!

Preparatory work

Computer: install CentOS system

Software: VMware

Operation steps

The first step

Enter grub2-mkpasswd-pbkdf2 and you will see Enter password: (enter password), Reenter password: (re-enter password)

PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.1B34404433526E5002B881AAD026E76B27713C1D26A1471C4907D5A31E86132920D23E5DC8E9DA211A24057CBE9384C158FF2892A26ECEDE790F8C6D3BB2C7BF.55D8820C747338D943E05484E457411F645FD6B7564A903D7CF6780528988AC6C998FB6B7DF67EC559039BC465970C82182D7FA5F36781DDB86FB40F47FE5269 (copied in advance, needed by vi text editor)

Step two

Type # cp / etc/grub.d/40_custom / etc/grub.d/40_custom-bak (back up / etc/grub.d/40_custom, and if there is an error, you can find the original file), # cp / boot/grub2/grub.cfg / boot/grub2/grub.cfg-bak (backup the startup menu / boot/grub2/grub.cfg)

Step three

# vim / etc/grub.d/40_custom (add the following)

Set superusers='root'

Password_pbkdf2 root\ grub.pbkdf2.sha512.10000.1B34404433526E5002B881AAD026E76B27713C1D26A1471C4907D5A31E86132920D23E5DC8E9DA211A24057CBE9384C158FF2892A26ECEDE790F8C6D3BB2C7BF.55D8820C747338D943E05484E457411F645FD6B7564A903D7CF6780528988AC6C998FB6B7DF67EC559039BC465970C82182D7FA5F36781DDB86FB40F47FE5269

There are only two lines in the above. The backslash after line 2 root is a hyphen. It means that the following content is the same as the previous one.

The fourth step

# grub2-mkconfig-o / boot/grub2/grub.cfg (recompiled the startup menu using the file in the / etc/grub.d directory)

The following information is displayed:

Generating grub configuration file...

Found linux image: / boot/vmlinuz-3.10.0-862.el7.x86_64

Found initrd image: / boot/initramfs-3.10.0-862.el7.x86_64.img

Found linux image: / boot/vmlinuz-0-rescue-825a7cb0361a4b7cb98141a640ef42ad

Found initrd image: / boot/initramfs-0-rescue-825a7cb0361a4b7cb98141a640ef42ad.img

Done

# cat / boot/grub2/grub.cfg

As you can see, new content brought in from 40_custom has been added to the new startup menu.

Step five

# reboot

Restart the system. When displaying the GRUB menu, click in the middle of the window with the mouse, and then press the letter e to modify the startup parameters. "Enter username" (enter your user name) will immediately appear on the screen. Enter root, and you will be prompted for "Enter password" (enter password). Enter the password 123456, and you can see the interface that modifies the startup parameters.

Step six

Remove this password protection, delete the newly generated startup menu, and copy back the previously backed up startup menu.

# rm-f / boot/grub2/grub.cfg

# cp / boot/grub2/grub.cfg.bak / boot/grub2/grub.cfg

# reboot

After restarting, try to modify the GRUB menu startup item, and you will no longer be prompted for the password. You can change the root password again.

Thank you for your reading, the above is the content of "CentOS how to modify GRUB menu startup items", after the study of this article, I believe you have a deeper understanding of how CentOS modifies GRUB menu startup items, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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