Thursday, December 23, 2010

How to set password in GRUB and make it more secure.

Now a days in every IT Company security is the main & serious issue.
Use the following steps to set Password in grub, so that only authenticated users have full access of it.

Steps :


  1. Make a MD5 encrypted password hash by "grub-md5-crypt" command, Make a note of password hash.

  2. Now edit GRUB configuration file "/boot/grub/grub.conf" with any text editor, and add a line in to it as below;

  3. Save file & Reboot your system to check.
  4. Next, when system reboots go to grub by interrupting boot process (Keep Pressing any key after bios loads), Now once you see grub screen press "P" as instructed there on the GRUB screen, it'll ask you for password.

     
  5. Now after entering password, it'll go to unlocked grub screen.

To remove this password, again edit /boot/grub/grub.conf & remove "password --md5 <MD5 Hash>" .

-Enjoy ;)

4 comments:

  1. Interesting tips i am read all article this information is very useful me thanks for nice sharing keep it up........
    disk crash recovery

    ReplyDelete
  2. how to remove that password.. if i forget the grub and root password.

    ReplyDelete
  3. It's simple ... follow below steps:

    1. Boot from your OS bootable 1st CD/DVD.
    2. Go into "Rescue Mode", in DVD boot prompt "boot: linux rescue".
    3. chroot DVD system image,
    #chroot /mnt/sysimage
    4. Edit /boot/grub/grub.conf and remove "password --md5 " line. This will remove grub password once you reboot OS.


    At the same time when you are in rescue mode change root password using "passwd" command on root "#" prompt.

    ReplyDelete