Home » Operating Systems » Mount VirtualBox shared folder on Ubuntu or Linux guest

Mount VirtualBox shared folder on Ubuntu or Linux guest

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.

Mount VirtualBox Shared Folder on Ubuntu

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 2017

Mount VBox Shared Folders Ubuntu / Debian Guest

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/USER/sf_ShareName or /media/sf_ShareName, depending on your guest OS.

mount vbox shared folder on ubuntu
VirtualBox Shared Folder Auto-mount

In the example shared folder shown in the picture above, Folder Name is also known as ShareName. Its mount point will be: /media/htpcbeginner/sf_Share or /media/sf_Share, depending on the guest OS. Username htpcbeginner will be different in your case. Navigate to these folders to access the files.

VitualBox Shared Folder Permissions

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

Note that /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.

Mount VirtualBox Shared Folder on Ubuntu Linux
Symlinked VBox Shared Folder in Xubuntu

Manually Mount VBox Shared Folder on Ubuntu

Now what if, you did not automount the shared folder? You may go to Device->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

Replace ShareName with 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.

Using 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

  1. Install VirtualBox - Windows 7/8/10 / Ubuntu/Debian
  2. Install VirtualBox Extension Pack - Linux and Windows Host
  3. Install Guest OS on Virtual Box - Ubuntu Server
  4. Install VirtualBox Guest Additions - Windows Guest / Linux Guest
  5. Update VirtualBox Guest Additions - Windows Guest / Linux Guest
  6. Setup VirtualBox Shared Folder - Windows and Linux
  7. Mount VirtualBox Shared Folder - Windows Guest / Ubuntu Guest
  8. Access USB Drive on VM - Windows and Linux Guest
  9. Configure Home Server on VirtualBox - Ubuntu Server
We Are Hiring: Familiar with Media Streaming, HTPC, Home Server, Smart Home, and Home Automation topics? Write about it and earn money. No writing experience needed. APPLY HERE.

Get 20% OFF with IPVanish VPN:

♦   Hide your browsing and streaming activity: No logs and no tracking
♦   Access geo-restricted content from anywhere
♦   Encrypt and anonymize: Kodi, Plex, Downloads, Personal Info
♦   Windows, Mac, Linux, Android, iOS, Router, and more.
♦   Money back guarantee - Sign Up Now

About the author

Anand

Anand is a self-learned computer enthusiast, a part-time blogger, and a Food Scientist by career. He has been blogging since 2010 on Linux, Ubuntu, Home/Media/File Servers, Smart Home Automation, and related HOW-TOs on htpcbeginner.com and smarthomebeginner.com.