Ubuntu – Adding user to a group – Why had to reboot


I was not able to access the VirtualBox shared folder, so I made the user part of the vboxsf group. But, still not able to access it. Rebooting the guest resolved the problem. Is it a bug? A reboot is not required to add a user to a group.

sudo usermod -a -G vboxsf praveensripati

There was similar query here.

I am using 11.10 and don't remember seeing similar behavior in 11.04.

Best Answer

After making modifications to the groups of an user, the changes are not immediately visible. You need to re-login for that (which is accomplished with a reboot as well).

You can test which you belong to with the id -Gn command. After adding yourself to a random group, you'll notice that the group is not immediately visible in the output of that command. If you do not want to restart the graphical session ("re-login"), perform a direct login:

su - $USER

Enter your password and you'll be logged in with the new group settings applied. From there, start virtualbox and try it again. Note that you'll have to keep the console open now (unless using screen) so it might be easier to re-login.