I accidentally removed my user from the sudo group.

A friend of mine told me to go into recovery mode and edit the visudo file.

The problem is, I don't know how to get into recovery mode. Can anyone please tell me how to do this? I am on ubuntu server 10.04 64bit.



I think you need to hold down the SHIFT key during boot and this should present you with the option to boot to recovery mode.

EDIT: (Assuming it is a single and not a dual boot system)

  • It is a single boot. Thanks I will try this when I get home :) – AntonioCS Aug 11 '10 at 10:30

Once you're in, you don't edit the visudo file; you can either

  • use visudo (assuming you know how to use vi, or do EDITOR=nano visudo (or whatever editor)), which safely edits /etc/sudoers and does sanity checking before saving
  • addgroup <username> admin, since the admin group is in the sudoers file

Of course, you shouldn't add yourself to the admin group if you weren't in it to start with... which won't be a problem if it's your server...

  • Thanks! I was in the admin group I just used usermod -G without -a, and yes the server is mine. It's just a small home server. – AntonioCS Aug 11 '10 at 20:49
  • Thanks again! I used the command usermod -a -G sudo <username> – AntonioCS Aug 11 '10 at 21:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.