During start up.(I.e when boot logo is display) press escape key to view menu. In some ubuntu distributions you have to press shift several times to view the menu. On the menu select recovery mode ussually the second option in most systems.Then choose drop to root shell prompt. On the konsole screen displayed type passwd new password to set the password then confirm(Note the konsole prompt should be some thing like root@hostname$ ). If it works type init 3 to go into runlevel 3. If the Gui is not displayed type startx(one word).
viola you got a new password. Cheers