VirtualBox Linux shared folders how-to

Switching from Ubuntu/Debian to Manjaro/Arch linux as VirtualBox guest operating systems has consequences.

First, Manjaro/Arch already has the virtualbox guest extensions pre-installed, which is very convenient. These extensions allow running the virtual machine full screen with adjusted resolution and mounting shared folders with the host OS.

Second, an additional manipulation is required for Ubuntu to make shared folders accesible (as described here):

Question: I configured a shared folder between the Windows host and Ubuntu guest. The folder mounts at start up but its empty. It also has a padlock sign.

Answer: You, as a user, were not added to the vboxsf group, to which the mounted share folder belongs. To allow access to the shared folders permanently, in a Terminal window on the new Ubuntu:

sudo usermod -G vboxsf -a username

where you replace username with your own user name. This command appends the user “username” to the vboxsf group, which is the owner of the shared folders (found in /media/ on the Ubuntu box). You won’t need to run a script at startup once you own the mounted shared folder.

On Manjaro/Arch Linux (with LXDE), the mount does not happen automagically. I created a ‘shared’ folder in my user home directory. Next, I mounted the shared folder using the virtualbox mount command:

sudo mount.vboxsf temporary /home/myusername/shared

EDIT: the command allows some read access but no write access. To have access in both directions as a user follow the instructions detailed in a superuser answer:

sudo mount.vboxsf -o gid=1000,uid=1000,rw temporary /home/myusername/shared

I wrote this blog post as a reminder for myself and in the hope that it could be useful for someone else (even if I already wrote some of this information in a previous blog post)

Advertisements