Add a password to the grub System Boot manager

Source: Internet
Author: User
Tags crypt md5 encryption

Directory

1. Grub plaintext encryption;
Ii. MD5 encryption method of grub;

    1. Use the grub-md5-crypt to generate the MD5 password of grub;
    2. Change/etc/grub. conf

Iii. About this article
Iv. References
V. Related Documents


++ ++
Body
++ ++


1. Grub plaintext encryption;

For example, before I set the password,/etc/GRUB looks like this:

 

default=1
timeout=10
splashimage=(hd0,7)/boot/grub/splash.xpm.gz
title Fedora Core (2.4.22-1.2061.nptl)
root (hd0,7)
kernel /boot/vmlinuz-2.4.22-1.2061.nptl ro root=LABEL=/
initrd /boot/initrd-2.4.22-1.2061.nptl.img
title WindowsXP
rootnoverify (hd0,0)
chainloader +1

The following is what we will do after adding:default=1
timeout=10
splashimage=(hd0,7)/boot/grub/splash.xpm.gz
password=123456
title Fedora Core (2.4.22-1.2061.nptl)
lock
root (hd0,7)
kernel /boot/vmlinuz-2.4.22-1.2061.nptl ro root=LABEL=/
initrd /boot/initrd-2.4.22-1.2061.nptl.img

title WindowsXP
rootnoverify (hd0,0)
chainloader +1

From the above, we can see that the GRUB Password is 123456, and lock means to RedHat
Fedora is locked. If an error occurs during startup. Press the P key and then enter the password. I set 123456. Of course, I should enter 123456 and another password.
I'm sure I can't pass it. Is it confidential ??


Ii. MD5 encryption method of grub;

Upon advice from jerboa, I read the grub document again. I do feel that it is safer to use MD5 encryption to verify the GRUB Password. I have to write this tutorial in order to let my friends who are cooking like me know how to encrypt the GRUB Password through MD5. Haha, the master is free of reading. This article is prepared by fellow cainiao.
Use MD5 to encrypt the GRUB Password, which is more secure.


1. Use the grub-md5-crypt to generate the MD5 password of grub;

Through the grub-md5-crypt to add the password GRUB Password calculation, for example, we want to set the GRUB Password is 123456, so we first use MD5 to encrypt the password 123456

[Root @ linux01 beinan] #/sbin/grub-md5-crypt
Password: Enter 123456 here
Retype password: Enter 123456 again
$1 $7udl20 $ ESB. xrpg2a2fv8aeh34nz0

$1 $7udl20 $ ESB. xrpg2a2fv8aeh34nz0 is the value generated after the password is added through the grub-md5-crypt. We need to remember this value, but it is still a bit useful.


2. Change/etc/grub. conf

For example, the content of my original/etc/grub. conf file is as follows.

default=1
timeout=10
splashimage=(hd0,7)/boot/grub/splash.xpm.gz
title Fedora Core (2.4.22-1.2061.nptl)
root (hd0,7)
kernel /boot/vmlinuz-2.4.22-1.2061.nptl ro root=LABEL=/
initrd /boot/initrd-2.4.22-1.2061.nptl.img
title WindowsXP
rootnoverify (hd0,0)
chainloader +1

Therefore, I want to add password -- MD5 $1 $7udl20 $ ESB. xrpg2a2fv8aeh34nz0 to/etc/grub. conf, and where should I add the lock? Please refer to the following changes to the instance;

 

timeout=10
splashimage=(hd0,7)/boot/grub/splash.xpm.gz
password --md5 $1$7uDL20$eSB.XRPG2A2Fv8AeH34nZ0
title Fedora Core (2.4.22-1.2061.nptl)
lock
root (hd0,7)
kernel /boot/vmlinuz-2.4.22-1.2061.nptl ro root=LABEL=/
initrd /boot/initrd-2.4.22-1.2061.nptl.img

title WindowsXP
rootnoverify (hd0,0)
chainloader +1

Let's take a closer look, from the above we modified/etc/grub. conf has used our first step through the/grub-md5-crypt generated password ?? Is it a bit secure ??


3. About this article;

This article has been written for more than two years. The posting time of the original post is-10-12.
At, I practiced and replied to the question raised by sxtywujian. But later, jerboa said that it could be encrypted using the MD5 algorithm ., In fact, this problem is extremely simple.
At that time, I was very weak in reading documents. And will not take the initiative to learn. I just tried to solve the problem after reading the post. When I sorted this post, I thought of
Linuxsir, a fellow who had been on the altar all day;

Original post:How to set the GRUB Password?


4. references;

GNU grub manual and FAQ


5. related documents;

Grub, System Boot manager for beginners
GNU grub manual and FAQ
Taking wingrub as an example to describe how to use wingrub to guide Linux Installation
Two Representation Methods for storing devices in Linux

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.