VirtualBox shared folders are owned by root in Lubuntu guest

My Setup is as follows -

Host: Ubuntu Server 14.04 Guest: Lubuntu Desktop 15.10

I have shared dirs on host to guest with automount option, and the directories show up in Guest OS's just fine - /media/sf_sharename

Also, the user of guest is added to vboxsf group.

The problem is that all the shared dir and its contents are owned by root. I have tried chown -R, but it finishes without reporting error wihtin guest but the ownership does not change.

I have another setup where guest is ubuntu desktop 15.10, and I did not face this problem there.

I need rw access on those shared dirs. How to fix this?


Solution 1:

On Ubuntu Server host execute these commands :

sudo chmod -R 777 /path-to-shared-folder/shared-folder

sudo chown -R user1:user1 /path-to-shared-folder/shared-folder  

On Lubuntu Desktop guest execute this command :

sudo usermod -G vboxsf -a user2

Restart the guest system for changes taking effect.

Note : user1 = your host user name | user2 = your guest user name

Solution 2:

No need to change main group of user - add user into group is sufficient.

sudo adduser $USER vboxsf

After the command do a restart or logout and login.