2

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?

Chang
  • 364

1 Answers1

5

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
  • 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 06:47
  • @enzotib Recovery mode worked. I had to exit the readonly mode to change the /etc/group file with gpasswd. – Chang Oct 21 '11 at 07:03