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. ]

grub>

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

Do you have the right skills?

Our IT Skills Watch page reflects an up to date IT skills demand leaning towards the Linux and Unix environment. We have considered a number of skills and operating systems.

See the result...

Linux Online Training

Learn to run Linux servers and prepare for LPI certification with Linux Academy. 104 available video lessons with PDF course notes with your own server!

Go to top