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 clean-installed Ubuntu 11.10 today, and then installed VirtualBox. This required me to add myself to the vboxusers group, and since 11.10 seems to no longer have a graphical app to add users to a group, I ran the following command:

sudo usermod -G vboxusers stephane

This is a problem. I now see what I should have run instead is:

sudo usermod -aG vboxusers stephane

The end result is I'm no longer in the groups I should be in. Including whatever group is required to run "sudo". When I run any command as sudo now, I get the following:

$ sudo ls
[sudo] password for stephane: 
stephane is not in the sudoers file.  This incident will be reported.

Is there a way to fix this, or do I need to re-install from scratch again?

share|improve this question

3 Answers 3

up vote 27 down vote accepted
  1. During boot, press and hold the left Shift key, and you should see the GRUB menu.
  2. Select the entry containing (recovery mode) and wait.
  3. You should now be presented a menu. Select:

    remount    Remount / read/write and mount all other file systems 
    

    wait for your file systems to get mounted with read/write permissions, then press Enter.

    If this option won't go, you can solve this entering with the 'root' option and typing mount command to use the system partition this way:

    mount -o remount /dev/sda3
    

    You can check out which is your system partition with 'fsck' command or viewing /etc/mtab.

  4. Now another menu comes up. Select:

    root       Drop to root shell prompt
    
  5. Now re-add your user to the admin group (for Ubuntu 11.10 and earlier):

    adduser <USERNAME> admin
    

    Or to the sudo group (for Ubuntu 12.04 and later):

    adduser <USERNAME> sudo
    
  6. Reboot and you should be able to use sudo again.

share|improve this answer
1  
If you don't see the "remount" menu, you can select "fsck" first, it will remount you filesystem to read/write. After that, you can add your user in root mode. –  Jiejing Zhang Sep 19 '13 at 22:59

If root login is enabled on your system just drop terminal via Control+Alt+F1 without log in to X. Log in as root and then just add the desired user to admin group (for Ubuntu 11.10 and earlier):

adduser desired_user_name admin

For Ubuntu 12.04 and later, add the user to the sudo group:

adduser desired_user_name sudo

If you did not enable root login just choose recovery mode from Grub and then try root shell.

Root Shell

After that you can again add your desired user to the admin (or sudo) group.

share|improve this answer

I've tried various combinations after doing the same thing as the remount menu option seems not to be in 12.10. I have tried everything else in this post from root. The last was

umount -a
mount -o -w /<path> /

This resulted in the filesystem still being ro due to a setting in fstab to boot ro on filesystem error I think, with it stating it seemed to be ro after mount.

I finally managed it with

mount -o rw,remount /

Although I am not sure how this is different from the previous set of commands.

After applying this variation, adding a user to the admin (11.10 and ealrier) or sudo (12.04 and later) group is done the same way:

adduser username admin    # 11.10 and earlier
adduser username sudo     # 12.04 and later
share|improve this answer

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.