Ubuntu – When I add theself “vboxusers” group I an no longer in the “admins” group

usersvirtualbox

I'm using Ubuntu 11.10 and I installed VirtualBox.

This required me to add myself to the vboxusers group but when I add myself to vboxusers group I am no longer be in other groups and especially admins group!

When I add myself back to admins group I no longer be am in the vboxusers group !

Commands that I used

  • to add user to "vboxusers": usermod -G vboxusers myusername

  • to add user back to admins group in single user mod: usermod -aG admin myusername

Best Answer

Your second command is right.

By default, usermod -G replaces all supplementary groups the user is in (the primary group is generally named the same as your username, and specified separately; don't mess with that though). By also using -a it appends the groups you give.

So this should work (and does, for me, just tried it):

usermod -aG vboxusers myusername

If running that command takes you out of any other group then you've found a bug. Note you have to relogin to see the effects.

Related Question