Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I installed Ubuntu 11.10 with a username fooname. And then I did something like

sudo usermod -G vboxsf fooname

Then, guess what: no one is a sudoer. How can fooname be back as a sudoer?

In addition, what should I have executed to ADD fooname to the group vboxsf?

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

You will likely have to boot off a live CD or some other medium, mount the root partition of your main install, and edit the /etc/group file and add your user name to the admin group (that is, find the line starting with admin and add your user name to the fourth field).

Once that is done, you should be able to boot normally and have sudo privileges. You'll probably want to reinstate your other group memberships. On my system, I have the following:

  • james (which is also my user name: you should have a group based on yours, and it should be your primary group membership)
  • adm
  • dialout
  • cdrom
  • plugdev
  • lpadmin
  • admin
  • sambashare

You should be able to make these changes in the normal way.

To add a group membership without replacing all the others, the command you should have used is:

sudo usermod --append -G vboxsf fooname
share|improve this answer
3  
A root shell in recovery mode could be enough. And better to use standard tools (like gpasswd -a james admin) than directly editing group file. –  enzotib Oct 21 '11 at 6:47
    
@enzotib Recovery mode worked. I had to exit the readonly mode to change the /etc/group file with gpasswd. –  FEQ Oct 21 '11 at 7:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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