Recover Linux grub boot loader password

| May 11, 2011

You need to boot system into single user mode, at boot: prompt type linux single:
boot: linux single

Mount your partition:
# mount /dev/sdb1 /mnt

Remove Grub password

a) If you are using Debian Linux you need to modify /boot/grub/menu.lst file:
# cd /mnt/boot/grub
# vi menu.lst

b) If you are using Suse Linux you need to modify /etc/grub.conf file
# cd /mnt/etc
# vi grub.conf

If you are using Red Hat / Fedora Linux you need to modify /boot/grub/grub.conf file
# cd /mnt/boot/grub
# vi grub.conf
Once file opened using text editor, locate password line and remove it:
password –md5 $1$9sdflksdf/sdf44k

Save file and reboot the system.
# sync; sync
# cd /
# umount /mnt
# reboot
Change Root password

Now your Grub password removed from system. You need to login to system without password. To restore root user password boot system into single user mode.

1) At Grub prompt press ‘e’ to edit command before booting.

2) Select second line

3) Again, press ‘e’ to edit selected command

4) Type following line
init=/bin/shORinit=/bin/bash

4) Press ‘b’ to boot system

5) Now you are at shell prompt. Just change root password with passwd command:
# passwd

Tags:

Category: Linux Administration

Comments are closed.