You can reboot with inserting init=/bin/bash into the kernel parameters.
It will bring you a very simple system, which is not functioning at most, but you can still:
mount -o remount,rw /
mount -o remount,ro /
In case even the boot loader is not capable to provide you CLI (eg lilo) or it's been restricted (password protected grub), you have to get a live cd, mount the drive, mount the root partition by hand, reset the password and reboot the system.
I am sure a lot of persons will advise getting a boot cd, so that part is not a problem.
You can always choose System Rescue CD for this (http://www.sysresccd.org/Main_Page)