How do I add a user to sudoers file?

Solution 1:

Sounds like a bit of a predicament you're in. If you've given your root account a password, su may allow you to elevate privileges and add your user to the group "sudo" or "admin".

If not, have you tried running a live CD? You should be able to mount your root partition from the Ubuntu live CD fairly easily, say to /mnt/tmproot/, and add this line somewhere in /mnt/tmproot/etc/sudoers:

username ALL=(ALL) ALL

where "username" is whatever your username is.