I set up an administrator account for myself when I set up a new Ubuntu system. Somewhere along the line I did something wrong, and my account is now a standard account. I no longer have sudo privileges; when I try to use sudo, it asks for the root password rather than my password. I never set up a root password. Is there a default setting for that password? I can't fix anything without that password, because I need root access to make the fix.
My best guess is that what went wrong may have been due to the following sequence of events: I used addgroup
to create a group named family. I used adduser
to add an account for my wife, and usermod
to put her in the family group. I then used usermod
to put myself in the family group. Might I have accidentally removed myself from the sudoers list that way?
I needed two additional pieces of information to solve my problem:
- By booting in recovery mode, and selecting "root" from the menu, I could operate as root without knowing root's password, even if logging in as root has been disabled by not giving it a password.
- When booting in recovery mode, the root partition defaults to read-only mode. I needed to use
mount -rw -o remount /
in order to make it writable, before I could make any changes.