You may have setup VirtualBox shared folder as we had previous described but you cannot use it or copy files to it until you mount VirtualBox shared folder on Ubuntu or Linux guest OS. Setting up a shared VBox folder allows you to easily share files between host OS and guest OS. This post shows how to mount VBox shared folder on Ubuntu guest. This method works on almost all Linux distributions.
Table of Contents
The steps for mounting VBox shared folders is different for Windows and Ubuntu / Debian. Windows guide for mapping VBox shared folder will be published next. This guide only shows how to mount VirtualBox shared folder on Ubuntu and other Linux guest OSes. Host OS on which Oracle VirtualBox VM is installed can be anything.
Before you try to mount a shared folder as described in this guide, make sure that you have setup shared folder on VirtualBox.
Recommended HTPC / Home Server Builds:
- Best Home Theater PC Build 2017 to do it all (Plex, Kodi, NAS, Gaming)
- Best Emby Server builds 2018 – Pre-built and DIY options
- Medium Budget 4K HTPC Build 2017 for Kodi, Plex and Gaming
- Cheap 4K HTPC Build for Kodi, OpenELEC, and LibreELEC 2017
- Low Power Home Server Build 2017 for Network File and Media Storage
- Best HTPC for Kodi with 4K on a Medium Budget 2017 (~$400)
- Energy efficient budget HTPC-NAS combo build 2016
Mounting VirtualBox shared folders is easy on Linux guest OSes. If you enabled
Auto-mount while creating shared folder then it should automatically be mounted to
/media/sf_ShareName, depending on your guest OS.
In the example shared folder shown in the picture above,
Folder Name is also known as
ShareName. Its mount point will be:
/media/sf_Share, depending on the guest OS. Username
htpcbeginner will be different in your case. Navigate to these folders to access the files.
You may encounter permissions issues when trying to access VirtualBox shared folder on Ubuntu (or other Linux distros). The shared folder is mounted with 770 permissions with
root user and
vboxsf as the group. Therefore, you need to enable
root (administrator privileges) to access the shared files. But this can be inconvenient and you may want to the current user (you) to be able to access the files without having to enable root or opening your file explorer with root privileges.
To mount VirtualBox shared folder on Ubuntu and access everything within the shared folder as the user, in this example
htpcbeginner, you will have to manually add the user to
vboxsf group using the following command:
sudo usermod -a -G vboxsf USER
Of course, replace
USER with your username. Once done, the user will have read/write access to the VBox shared folder. For easy access / convenience, you may create a symbolic link to the mounted shared folder in your home folder:
sudo ln -s /media/htpcbeginner/sf_Share /home/htpcbeginner/Share
/media/htpcbeginner/sf_Share could be
/media/sf_Share depending on how your Linux OS mounts VBox shared folder. Also, replace
htpcbeginner with your username. Once done, you will have a symbolic link created to the Vbox VM shared folder in your home directory as shown below.
Now what if, you did not automount the shared folder? You may go to
Shared Folder Settings, edit the shared folder, and enable Auto-mount. You may also check "Make Permanent" if you want the mounting to stick on reboot. Alternatively, you may manually mount VirtualBox shared folder on Ubuntu or Linux, anytime, using the following command:
sudo mount -t vboxsf -o uid=$UID,gid=$(id -g) ShareName NewFolder
Folder Name from the first picture and
NewFolder with desired folder name (could be same as
ShareName). Using this command to mount VirtualBox shared folder on Ubuntu / Debian will automatically enable read/write permissions for the current user. These mounting instructions work on all Linux distributions.
fstab to auto-mount VirtualBox shared folders during boot does not work in recent versions of Ubuntu as VirtualBox services start after the filesystem is mounted. You may encounter "no such device" error as OS cannot find the shared folder to mount. The OS may stop booting. Hence, enabling
Auto-mount in the
Shared Folder Settings and adding the user to
vboxsf group is the way to setup automount during boot with required permissions. So there you go, mount VBox shared folder on Ubuntu or other Linux guest OSes, and enjoy seamlessly sharing files between the two OSes.
Complete Guide to Setting Up a Home Server on VirtualBox Virtual Machine:
- Install VirtualBox - Windows 7/8/10 / Ubuntu/Debian
- Install VirtualBox Extension Pack - Linux and Windows Host
- Install Guest OS on Virtual Box - Ubuntu Server
- Install VirtualBox Guest Additions - Windows Guest / Linux Guest
- Update VirtualBox Guest Additions - Windows Guest / Linux Guest
- Setup VirtualBox Shared Folder - Windows and Linux
- Mount VirtualBox Shared Folder - Windows Guest / Ubuntu Guest
- Access USB Drive on VM - Windows and Linux Guest
- Configure Home Server on VirtualBox - Ubuntu Server