4

Possible Duplicate:
How do I add myself back as a sudo user?

jiewmeng is not in the sudoers file.  This incident will be reported.

Whats happening? Its a home PC with me as the only user. I noticed this only happended recently. Perhaps after some recent update. I was running sudo add-apt-repository ...

Jiew Meng
  • 10,677

1 Answers1

5

It seems unlikely that just adding a repository would have removed you from sudoers (or more likely, the admin group).

Are you still in the admin group?

Simply run groups from a terminal. You should see a list come out. You're looking for the word admin. If that's in there, this isn't your issue.

The easiest way to restore your sudo rights is to reboot in recovery mode (hold left-shift at boot, select a recovery mode kernel, boot to the root prompt). Once in there you might be able to run (swap oli for your username) :

adduser oli admin

But I've seen some thing that suggest this might not work from a recovery console. Try it. If that doesn't work, or you want to check, run nano /etc/group

Look for the admin group and add your username to the end, like so:

admin:x:115:oli

You should then be able to reboot and be in the right group.

Has something melted /etc/sudoers?

Unfortunately you can't read /etc/sudoers unless you're root. So back to recovery mode (as above). Once you're in there run nano /etc/sudoers. You're looking for a pair of lines like this:

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

If that's there, this isn't your problem. If it's commented out or missing, whack it back in there!

Oli
  • 299,380