Auto-Mounting VirtualBox Shared Folders with a Linux Guest OS

VirtualBox has a feature where a folder on the host machine can be shared with a guest VM. VirtualBox can also mount these shared folders automatically when the user logs into the guest OS. For Linux guests, these auto-mounted shared folders are mounted into the /media directory, along with the prefix sf_. For example, the shared folder sharedfiles will be mounted to /media/sf_sharedfiles.

As only the user group vboxsf is granted permissions to the auto-mounted shared folders, you’ll need to add your user to the group to access the shared folder. Otherwise you’ll get a “Permission denied” error when trying to navigate to the shared folder.

sudo gpasswd -a username vboxsf

Make sure you log out of the guest OS, then log in again for the group membership to take effect.