Sometimes the need arises that one would need to set a password to disallow anyone else boot the system without correct password. This can be easily done when using GRUB as a loader. First boot your linux system. The enter grub's command prompt:

# grub
 GNU GRUB  version 0.97  (640K lower / 3072K upper memory)

       [ Minimal BASH-like line editing is supported.   For
         the   first   word,  TAB  lists  possible  command
         completions.  Anywhere else TAB lists the possible
         completions of a device/filename. ]


then type a md5crypt command which will ask for your password and spit out its equivalent in md5 encrypted version:

grub> md5crypt

Password: ****
Encrypted: $1$A9NHZ/$N.6k9riAFMbV/nfsZ2LnD1

Now depends on your Linux distribution locate and edit a grub's config file.

NOTE:GRUB's config file can be located at various places

  • /boot/grub/menu.lst
  • /etc/grub.conf
  • /boot/grub/grub.conf

Add your MD5 encrypted password to a grub's global configuration:

timeout         5
color cyan/blue white/blue
password --md5 $1$A9NHZ/$N.6k9riAFMbV/nfsZ2LnD1

save and reboot.

Free Linux eBooks

Go to top