How to Enable File Sharing between Host and Virtualbox Guest

In a previous tutorial, I showed you how to install virtualbox guest additions on Debian. This tutorial will explain how to enable file sharing between host and virtualbox guest OS. In order to do this, you have to install guest additions in the guest OS first, so if you haven’t done yet, check out that post and go back here when you are done.

Also read:

Install VirtualBox Guest Additions in Apricity OS Virtual Machine

How To Install VirtualBox Guest Additions in Fedora 23/24

Install Virtualbox Guest Additions on Ubuntu To Enable 3D Support

Enable File Sharing between Host and Virtualbox Guest

In the Virtualbox Manager window, right-click on your guest machine and select Settings.

Enable File Sharing between Host and Virtualbox Guest

In the left pane, select Shared Folders. Then click on the add button to add a shared folder.

Enable File Sharing between Host and Virtualbox Guest

Then in the Folder Path field, select a folder on your host machine.

Enable File Sharing between Host and Virtualbox Guest

You can check Read-only to let your guest have read access but no write permission to the shared folder on the host machine. Check Auto-mount to auto-mount the shared folder when the guest OS boots up. After that, click OK button.

Enable File Sharing between Host and Virtualbox Guest

Now start the Linux guest machine. In /media/ directory of the Linux guest,  you will find a new directory called sf_shared_folder if the shared folder name on the host is shared_folder. By default, only root and members of the vboxsf group have read and write access to this directory. So what we need to now is add your user to vboxsf group. Open up a terminal in the guest machine and enter the following commmand. Replace <username> with your real username.

sudo gpasswd -a <username> vboxsf

Log out of the current session and log back in. Now you can access the /media/sf_shared_folder directory.

You can create a soft link that points to /media/sf_shared_folder.

ln -s /media/sf_shared_folder /home/<username>/shared_folder

The above command will create a shared_folder directory under user’s home. File created in shared_folder actually resides in /media/sf_shared_folder.

How to enable copy and paste clipboard between host and guest

Another thing you may want to do is enable copy and paste clipboard between host and guest. To accomplish that, open the settings window of your virtual machine. Go to General > Advanced. Change the value of Shared Clipboard and Drap’n’Drop to Bidirectional. Then click the OK button.

Virtualbox Shared Clipboard

Rate this tutorial
[Total: 2 Average: 1.5]
  • wpeckham

    NOTE: This only works on operating systems with certain levels of drive mount support. Generally all modern Linux, Windows, etc. fall into this category. Some alternate operating systems do not, such as KolibriOS and ReactOS in their current state. Support for drive mounts at the required level is planned for ReactOS is in development but with no planned delivery date. I have not discussed or researched the question with the Kolibri team, but would expect it to be something they would be open to discussing.

    Afterthought, I have not tested things like FREEDOS with long file name support enabled. I suspect it would not work, but it may be fun to try.