How to add a password to Grub

Source: Internet
Author: User
Article Title: how to add a password to Grub. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

The purpose is to prevent others from modifying grub and start it in single-user mode.

You only need to modify the grub Startup File to add a line of password keywords, which can be stored in plaintext or after MD5 encryption. The following describes how to use MD5 encryption.

1. First Use/sbin/grub-md5-crypt to generate an MD5 password string

/Sbin/grub-md5-crypt
Password:
Retype password:
$1 $ oWpTe $/MWUUYbBlF.2RUZK8nbWU0

The original password is "abc ".

2. Modify the grub. conf file

Default = 0
Timeout = 5
Splashimage = (hd0, 0)/boot/grub/splash.xpm.gz
Hiddenmenu
Password -- md5 $1 $ oWpTe $/MWUUYbBlF.2RUZK8nbWU0
Title Red Hat Enterprise Linux AS (2.6.x-xx. EL)
  
.........

Note that the password must be added between the splashimage and title; otherwise, it cannot take effect.

Then restart the machine and you will find that you want to modify the grub menu. You must press P and enter the correct password to continue.

Add a grub. conf method using sed to modify all servers in batches.

GRUB =/boot/grub. conf
TEMP =/tmp/grub. conf

Grep-v password $ GRUB & cat $ TEMP | sed-e's/hiddenmenu \ npassword --
Md5 \ $1 \ $ oWpTe \ $ \/MWUUYbBlF.2RUZK8nbWU0/G'> $ GRUB

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.