How to automatically mount a folder and change ownership from root in virtualbox
- by Fiztban
It is my first time using virtualbox and ubuntu (14.04), I am on a host Windows 7 OS.
I am trying to mount a shared folder that has files I need to access both in the virtualbox and on the windows OS. I have successfully mounted them using the vboxsf from the Guest Additions installed.
To mount I used the command sudo mount -t vboxsf <dir name in vbox> <directory in linux for example I used sudo mount -t vboxsf Test /home/user/Test
I found several ways of mounting the directories automatically upon startup using for example the /etc/rc.local method (here) where you modify said file appending the command to it (without sudo). Or by using the fstab method (here). I prefer the rc.local method personally.
Once mounted it has permissions dr-xr-xr-x however once mounted the directory is of root ownership and chown user /home/user/Test has no effect. This means I cannot make or change files in it as a normal user.
In the VirtualBox the directory to be shared is not set as read-only.
Is there a way to automatically mount the shared folder and assign ownership to my non root user?