usermod is shell command for manipulating user accounts in Ubuntu and almost any other Linux distro. You can use it to add existing user to existing group, for example once installed Virtualbox (sudo apt-get install virtualbox-ose
) you should add your user account to vboxusers group to be able to use USB flash drives inside virtual machines.
To add user bob to supplementary group vboxusers use usermod command as follows (-a parameter specifies adding while -G points to group name):
sudo usermod -a -G vboxusers bob
Want to change user’s primary group from default to something else (e.g. group named adm)? No problems:
sudo usermod -g adm bob
From virtualbox manual:
After installation you need to put every user which should be able to access USB devices from VirtualBox guests in the group vboxusers
, either through the GUI user management tools or by running the following command as root:
sudo usermod -a -G vboxusers username
Note
The usermod
command of some older Linux distributions does not support the -a
option (which adds the user to the given group without affecting membership of other groups). In this case, find out the current group memberships with the groups
command and add all these groups in a comma-separated list to the command line after the -G
option, e.g. like this: usermod -G group1,group2,vboxusers username
.