[howto] Enable/Disable GRUB Password
NOTE: This is not a rock solid secured way of disabling access to your pc. But atleast for those “Windoze users” who have no clue wtf is a grub, it’s going to be pretty effective! I’m going to teach you how to enable as well as disable grub password.
Enable GRUB password:
1. Open terminal and type as root:
# cp /boot/grub/menu.lst /boot/grub/menu.lst.backup
2. Now that your GRUB is backed up. Type:
# grub
grub> md5crypt
Password: ******** [Type in the password that you want to encrypt!]
Now copy the encrypted message it gives you!
grub> quit
3. Open /boot/grub/menu.lst.backup and paste the message after initrd line. If you have a number of Grub entries , you must paste it [or use a different encrypted password using the above method] for every entry that you want to password protect! Use it like this:
title Debian GNU/Linux, squeeze/sid
root (hd0,1)
kernel /boot/vmlinuz-2.6.30-1-amd64 root=/dev/hda2 ro splash quiet vga=791
initrd /boot/initrd.img-2.6.30-1-amd64password – -md5 gasgd6876b2dsd2d/
paste the code after “password – -md5”
Note: Since wordpress has the weird habit of showing double hyphen as a single large one, I put a space in between the two, you just need to put two hyphens without any space in between!
Disable/Hack GRUB password:
1. You need a Linux live CD for this.
2. Insert the CD and boot from it.
3. In command line [or if you’re using ubuntu cd 😛 open a terminal and type]:
$ su
# fdisk -l [to check the name of the root directory]
# mount -t ext3 -o rw /dev/sda2 /mnt
[change ext3 to ext4 and /dev/sda2 according o the fdisk -l output]
# chroot /mnt /bin/bash
# nano /boot/grub/menu.lst
Now just remove the password line from the grub menu. 😛 Simple eh? Now save , unmount the partition and reboot!