In many systems, you can recover your root password by booting into single user mode.
If you use Grub, when the grub screen appears, select the system you want to fix and hite.
This will enable you to edit the entry. Take the line that looks something like
kernel /boot/vmlinuz ro root=/dev/hda2
Add the world
single
to the end of that line. When it boots, in Red Hat and many others, you will simply be presented with something like sh #. At that prompt, you can then change the root password by simply typing
passwd
If using Lilo rather than Grub, you would, at the lilo prompt, type the name you've given your kernel and the word single. So, assuming that your lilo.conf has
label=linux
you would, at the lilo prompt, type
linux single
Again, you'll be presented with a # prompt and be able to change the root password.