Tuesday, July 12, 2011

How to put the grub password in linux!

In Linux anyone can reset the root password from single usermode . So it is considered as a security fault if the machine is public. There comes the importance of putting the grub password, so that only admin is allowed to login if the machine is rebooted.

Here are the steps to put the grub password.

1) open the command prompt and type the following commands

2) grub

3) md5crypt

4) type the password

5) copy the encrypted password generated

6) Ctrl c

7) vi /boot/grub/grub.conf

8) paste the following line just above the 'title'

password --md5 "encrypted password here"

9) save and quit. Done.

I have give the sample grub file here.

======================================

#boot=/dev/hdb
default=0
timeout=15
splashimage=(hd1,8)/boot/grub/splash.xpm.gz
hiddenmenu
password --md5 %&mkj89(*$*J)$OO*=*

title CentOS (2.6.18-92.el5)
root (hd1,8)
kernel /boot/vmlinuz-2.6.18-92.el5 ro root=LABEL=/ rhgb quiet
initrd /boot/initrd-2.6.18-92.el5.img