Options to Transfer Files Between the Host Machine and a VirtualBox VM

Introduction

After creating a VM with Oracle VirtualBox, one of the first things that may be required is to copy files from the host machine to the VM. Fortunately, there are several options, ranging from very easy and built into VirtualBox to more difficult, but closer to real-world server setups.

For these examples, I’ll be using the virtual machines that I created for my Ubuntu Desktop and Ubuntu Server VirtualBox tutorials. I have also updated VirtualBox to the latest version.

Tested with: VirtualBox 7.2.6, Windows 11 (24H2 at time of writing), and Ubuntu Desktop 24.04.3 LTS and Ubuntu Server 24.04.3 LTS.

This post will grow over time as I am able to add documentation for new options. Currently, only Drag and Drop and File Manager are documented in this post. If you’re looking for shared folders or SSH/SCP/SFTP, those are not documented here yet.

File Transfer Options

Some options require Guest Additions. Instructions for installing Guest Additions can be found at the beginning of my post on how to fix drag and drop issues between host and guest ​.

Common options for transferring files between host and guest:

MethodDesktop RequiredWorks on ServerRelative Difficulty
Drag and DropYesNoEasy
VirtualBox File ManagerNoYesEasy
Shared FoldersNoYesMedium
SSH/SCP/SFTPNoYesHard

Drag and Drop (Requires a Desktop Environment)

Dragging and dropping a file is one of the simplest ways to copy a file from the host to the guest. Simply open a file manager window on the guest desktop and then drag the file from the host system to the target location on the guest system.

This option only works if the guest operating system has a graphical desktop environment installed.

Since it’s a common issue, if you try to use Drag and Drop and you get an error similar to:

“DnD: Error: Drag and drop to guest not possible – either the guest OS does not support this, or the Guest Additions are not installed”

Oracle VirtualBox: Fix the Drag and Drop Operation From Host to Guest Failed error explains how to fix that.

VirtualBox File Manager

Another very simple way to transfer files between the host and the VM is to use the VirtualBox File Manager. The steps are basically the same between Ubuntu Desktop and Ubuntu Server, but I’m going to show examples using both.

Transfer Files Using a Desktop VM

I’ve started the Ubuntu Desktop VM and have it open on my host machine.

Ubuntu Desktop VM Running

Ubuntu Desktop VM Running

The following steps can be executed to transfer files between the VM and the host using the VirtualBox File Manager.

  1. Click Machine > File Manager…
File Manager Option

File Manager Option

After clicking on File Manager…, the File Manager dialog will open.

File Manager Dialog

File Manager Dialog

  1. Start a Session

This part of the process is not very intuitive. In order to transfer files, we need to start a session in File Manager.

To start a session, enter the guest VM’s user credentials in the User Name and Password fields and click Open Session.

File Manager Open Session

File Manager Open Session

After clicking on Open Session, the Guest File System contents will be visible in the File Manager window and both the Host File System and Guest File System panels will be accessible.

File Manager Session Opened

File Manager Session Opened

  1. Transfer files between systems.

From here, VirtualBox is ready to transfer files. A good/safe place to start is the user’s home directory on the VM. I can navigate to the home directory by double-clicking on the home directory and then on the vboxuser directory.

Contents of User Home Directory

Contents of User Home Directory

I created a directory on my host machine under D:\VM File Transfer. I can click in the Host File System panel to navigate to that path.

Contents of Host File System Test Directory

Contents of Host File System Test Directory

From here, I can simply click the arrow button to copy the files from the Host File System to the Guest File System.

Button to Transfer Files from Host to Guest

Button to Transfer Files from Host to Guest

The file is transferred.

Transferred File Shown in Guest File System Panel

Transferred File Shown in Guest File System Panel

Multiple files or directories can also be selected in both the Host File System and Guest File System windows.

If I open the Files window on the Ubuntu Desktop VM, I can see the new file is now available on the VM.

File Showing in VM Files Window

File Showing in VM Files Window

Now that I’m done transferring the files, I can click the Close button to close the File Manager session.

Click the Close Button to Close the Session

Click the Close Button to Close the Session

Transfer Files Using a Server VM

I plan on adding step-by-step instructions for how to do this on a server, but for now, it’s enough to state that the steps are exactly the same for transferring files.

  1. Start the Server VM.
  2. Open the File Manager.
  3. Start a File Manager session using the VM credentials.
  4. Use the Host File System and Guest File System panels to transfer files.
  5. Close the session when complete.

Conclusion

There are several options for transferring files between the Host machine and a VirtualBox Guest VM, ranging in difficulty from relatively easy to relatively hard, depending on experience. Drag and Drop, VirtualBox File Manager, Shared Folders, and SSH/SCP/SFTP are common options. Drag and Drop and Shared Folders require VirtualBox Guest Additions. VirtualBox File Manager can work without Guest Additions, but Guest Additions improves compatibility. SSH/SCP/SFTP use network protocols and require network connectivity (Bridged or NAT with port forwarding) and an SSH server be installed and configured correctly on the guest VM.

Next steps for working with your VM:


The postings on this site are my own and do not necessarily reflect the views of my employer.

The content on this blog is for informational and educational purposes only and represents my personal opinions and experience. While I strive to provide accurate and up-to-date information, I make no guarantees regarding the completeness, reliability, or accuracy of the information provided.

By using this website, you acknowledge that any actions you take based on the information provided here are at your own risk. I am not liable for any losses, damages, or issues arising from the use or misuse of the content on this blog.

Please consult a qualified professional or conduct your own research before implementing any solutions or advice mentioned here.