December 24th, 2003, 09:17 PM
I have a problem here..I've forgot the password of my boot loader GRUB...Now i want to make some changes but I ve lost the password of GRUB..A fellow told me that this GRUB password can be reset or changed..Please let me know that how it can be done if possible? I ve already "googled" the issue ...didnt fine significant help..next thing I am planning to do is to look into the GRUB manual. Any hekp or links in this matter would be really appreciated....
December 24th, 2003, 10:27 PM
This is an easy one to fix. Mount your /boot partition, and edit /boot/grub/grub.conf The encrypted password is stored in there. Just create a new password hash and replace the one that's listed in there.
December 24th, 2003, 10:54 PM
In order to mount your /boot partition, your can use a linux distro bootable on a cd, like the excellent Knoppix.
Or you can also erase your MBR, reinstalling another boot manager. Installation CD of your distro must be able to do such a thing. Juste try to boot with it.
Life is boring. Play NetHack... --more--
December 25th, 2003, 05:30 PM
Why bother with boot CD's when you can just log in as root and do it from there? He only wants to change the grub password.
December 25th, 2003, 05:37 PM
Thank you for cooperation...but how can i mount my boot partition after booting from a bootable cd..sorry ..i am kinda newbie with my Linux Box...and where would this file would be if there is no boot partition ..i know i might sound silly with this problem..but please do help me and i dont want to loose grub as well...
December 25th, 2003, 07:09 PM
I see you've lost your root password. In that case, we need a bit of information about how the computer is set up, if you want step-by-step instructions. What distro are you running anyway? Some are more easy to recover than others using the install CD. To use a boot CD like knoppix, you'll need to know how the computer is set up, as in how many partitions there are, what's on each one, and what the device nodes are.
As an example, my PC dual-boots Windows XP Pro and Gentoo 1.4. I have 2 hard disks, with the primary master only having 1 partition for windows (/dev/hda1), and the slave having 4 partitions, the first of which is for windows (/dev/hdb1). The other 3 partitions, in order, are /boot (hdb2), swap (hdb3), and / (hdb4). The next thing I would do is boot from a linux CD, and look in /mnt for a suitable directory I can mounting my boot partition. Any will do, but you can't make any new directories in /mnt because it will be read-only due to being located on a CD. So, if the directory is empty, I'd just type:-
mount /dev/hdb2 /mnt
If it's not empty, I'd mount to a different directory inside /mnt e.g. /mnt/cdrom, if it exists. Then, all you got to do is type nano /mnt/xxx/grub/grub.conf to edit the file (xxx is the directory you chose to mount your boot partition). Put a # in front of the line that starts with password=. This will disable the grub password. Save the file, then type this in order to reboot:-
shutdown -r now
Now, when you get the grub screen back, choose linux, then press e to edit your command line. Add the word single to the end of the command-line in order to boot linux into single-user mode. This will give you a root shell. Type passwd and press enter. Type your new root password, and remember it. Then type reboot, and you're done.
It's easier than it sounds, trust me. If you don't actually have a seperate /boot partition, you just need to mount / instead of /boot.
December 27th, 2003, 08:13 AM
Thank you Beryllium9 ..
I have a single PC with two partitions. The distro I am using is RED HAT LINUX. I ve understood what you meant. Everything is clear except one thing. How do i get to the prompt after booting from bootable cd. do i have to type 'linux expert' or something like this to get on to the prompt where i could mount the partitions and nano that /mnt/whatever/grub/grub.conf and put a hash infronTof the line that is starting with 'PASSWORD'. I hope this is whatyou meant. Okie now one more thing just let me know two more things
1) can I still use 'vi' or I have to use 'nano' on the prompt that I'll get from the bootable cd.
2) what if i have installed the whole distro,but didnt entered a password for GRUB. But now after installation when its running I want to put a password on GRUB.What should I do then?
December 27th, 2003, 08:45 AM
How do i get to the prompt after booting from bootable cd. do i have to type 'linux expert' or something like this to get on to the prompt where i could mount the partitions and nano that /mnt/whatever/grub/grub.conf and put a hash infronTof the line that is starting with 'PASSWORD'. I hope this is whatyou meant. Okie now one more thing just let me know two more things
I would personally use LILO as my boot loader of choice. Use this command [/b] linux text[/b] instead of linux expert.
December 27th, 2003, 05:22 PM
Ah, you're using redhat. In this case, recovery is quite easy. Just boot from your install CD, then type linux rescue at the boot: prompt. Once you've got a prompt, type chroot /mnt/sysimage, and you'll be dropped to a root shell on your linux install. Then you can just type passwd to change your root password. Once you've set a new password, type exit and press enter. Then press ctrl+alt+del to reboot. Log in as root, then use gedit to change the grub password in /boot/grub/grub.conf. Simple
If you want to add a password to grub, you need to add a password hash to the grub.conf file. I recommend creating an md5 hash. Then between the splashimage= line and the first title line add this:-
password --md5 md5hash
Replace md5hash with the hashed password you created. And yes, you can use any text editor you like to modify grub.conf. It is just an ordinary text file after all.
December 27th, 2003, 07:58 PM
gee Beryllium9...you have been really helpful..let me try it on my machine...there is also another post going on with the subject of "cracking linux passwords"...it s informative too...
thanx to you and AO...
I 'll hope that I'll get it done tomorrow.