4.4. Drag and Drop

Oracle VM VirtualBox

4.4. Drag and Drop

Starting with version 5.0, VirtualBox supports to drag and drop content from the host to the guest and vice versa. For this to work the latest Guest Additions must be installed on the guest.

Drag and drop transparently allows copying or opening files, directories and even certain clipboard formats from one end to the other, e.g. from the host to the guest or from the guest to the host. One then can perform drag and drop operations between the host and a VM as it would be a native drag and drop operation on the host OS.

At the moment drag and drop is implemented for Windows- and X-Windows-based systems, both, on host and guest side. As X-Windows sports different drag and drop protocols only the most used one, XDND, is supported for now. Applications using other protocols (such as Motif or OffiX) will not be recognized by VirtualBox.

In context of using drag and drop the origin of the data is called source, that is, where the actual data comes from and is specified. On the other hand there is the target, which specifies where the data from the source should go to. Transferring data from the source to the target can be done in various ways, e.g. copying, moving or linking.[19]

When transferring data from the host to the guest OS, the host in this case is the source, whereas the guest OS is the target. However, when doing it the other way around, that is, transferring data from the guest OS to the host, the guest OS this time became the source and the host is the target.

For security reasons drag and drop can be configured at runtime on a per-VM basis either using the "Drag and Drop" menu item in the "Devices" menu of the virtual machine or VBoxManage. The following four modes are available:

  • Disabled disables the drag and drop entirely. This is the default when creating new VMs.

  • Host To Guest enables performing drag and drop operations from the host to the guest only.

  • Guest To Host enables performing drag and drop operations from the guest to the host only.

  • Bidirectional enables performing drag and drop operations to both directions, e.g. from the host to the guest and vice versa.

Note

Drag and drop support depends on the frontend being used; at the moment only the VirtualBox Manager frontend provides this functionality.

To use VBoxManage for controlling the current drag and drop mode, see Chapter 8, VBoxManage. The commands modifyvm and controlvm allow setting the VM's current drag and drop mode via command line.

4.4.1. Supported formats

As VirtualBox can run on a variety of host OSes and also supports a wide range of guests, certain data formats must be translated after those got transferred over so that the target OS (that is, the side which receiving the data) is able to handle them in an appropriate manner.

Note

When dragging files however, no data conversion is done in any way, e.g. when transferring a file from a Linux guest to a Windows host the Linux-specific line endings won't be converted to Windows ones.

The following formats are handled by the VirtualBox drag and drop service:

  • Plain text, from applications such as text editors, internet browsers and terminal windows

  • Files, from file managers such as Windows explorer, Nautilus and Finder

  • Directories, where the same applies as for files

4.4.2. Known limitations

The following limitations are known:

  • On Windows hosts, dragging and dropping content from UAC-elevated (User Account Control) programs to non-UAC-elevated programs and vice versa is now allowed. So when starting VirtualBox with Administrator privileges then drag and drop will not work with the Windows Explorer which runs with regular user privileges by default.


[19] At the moment only copying of data is supported. Moving or linking is not yet implemented.