46

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.

  • 1
    thanks for posting above. I was having the same issue and did not think to reboot!! Still a bug but atleast i now know that rebooting solves the problem :) – ToughPal Aug 09 '13 at 11:29

2 Answers2

39

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.

Lekensteyn
  • 174,277
  • 6
    Tiny note: you don't need to re-login to be part of the group: calling newgr vboxsf, after the adduser USER vboxsf (or usermod, as used in the question) will let you join the group. – invernizzi May 07 '13 at 16:21
  • 4
    @invernizzi I think you meant newgrp. It looks like a new shell is opened (similar to su), but without having to enter a password. Thanks for the tip! – Lekensteyn May 07 '13 at 20:46
  • 1
    Big WARNING: With Ubuntu 20.X a Logout seems not to be enough. – maugch Dec 15 '21 at 20:45
0

Did you try passing the UID and GID to the mount command? Like this:

sudo mount -t vboxsf -o uid=1000,gid=1000 sharedfolder mountPoint
Peachy
  • 7,117
  • 10
  • 38
  • 46