Sunday, October 23, 2011

Adding Users to Existing Groups, Ubuntu Oneiric

Ubuntu Oneiric provides a very simple 'User Accounts' dialog which misses quite a few important features. It only lets you choose between an 'Administrator' or a 'Standard' account when you are creating/modifying an account. What if you want to add a user to a certain existing group? It doesn't even list the groups, modifying those groups is out of question then. The only option left is to modify the groups from the command-line.


Lately, I again came across an old VirtualBox error, 'Failed to access the USB subsystem' in Ubuntu Oneiric. This error is common since VirtualBox 4.0 and hasn't been fixed yet. The error appears because the current user isn't added to the 'vboxusers' group during the installation of VirtualBox, and this can't be done manually from the 'User Accounts' dialog in Oneiric either. So as an example, we would add a user called 'tuxgarage' to the 'vboxusers' group in the following example. You can follow the same below mentioned steps for modifying any other groups as well, of course.

First go to the Terminal and find a list of existing groups by running:

groupmod

Press the <Tab> key 3 times without hitting <Enter/Return>.


Typing the command and pressing the <Tab> key thrice would show you a list of the existing groups and return you back to the prompt. Look for the exact name of your intended group here.

Now, for adding a user to an existing group, run:

sudo usermod -a -G vboxusers tuxgarage

Where is:
  • vboxusers = name of the group you want to add the user to
  • tuxgarage = name of the concerning user
If you want to make sure that the user was successfully added to the desired group, run this command:

cat /etc/group

Find your desired group and see if the username you just added is listed besides it.

Related Posts:

System , Troubleshooting , VirtualBox