I copied this from the Ubuntu forums:
http://ubuntuforums.org/showthread.php?t=1034098
There are a number of responses, but this looks like the best to me:
=================
When you boot the computer, select "recovery mode" from the Grub menu (if the menu doesn't show by default you should see a message that tells you to press Esc to open the menu).
You'll see some text scrolling on the screen for a while until another menu opens, now with options (resume/clean/dpkg/fsck/root/xfix). Use the arrow keys & Enter to select "root" and you'll end in command line as root user.
Now all you need to do is to run "password yourusername" and you will be able to set your user's password. When you've done that, run "reboot" to restart the computer.