With the shared folders feature of
Shared folders physically reside on the host and are then shared with the guest, which uses a special file system driver in the Guest Additions to talk to the host. For Windows guests, shared folders are implemented as a pseudo-network redirector. For Linux and Oracle Solaris guests, the Guest Additions provide a virtual file system.
To share a host folder with a virtual machine in
There are several ways in which shared folders can be set up for a virtual machine:
In the window of a running VM, you select Shared Folders from the Devices menu, or click the folder icon on the status bar in the bottom right corner.
If a VM is not currently running, you can configure shared folders in the virtual machine's Settings window.
From the command line, you can create shared folders using
VBoxManage sharedfolder add "VM name" --name "sharename" --hostpath "C:\test"
See
There are two types of shares:
Permanent shares, that are saved with the VM settings.
Transient shares, that are added at runtime and disappear when
the VM is powered off. These can be created using a check box
in
Shared folders can either be read-write or read-only. This means
that the guest is either allowed to both read and write, or just
read files on the host. By default, shared folders are read-write.
Read-only folders can be created using a check box in the
The host operating system must support symlinks. For example, a macOS, Linux, or Oracle Solaris host is required.
The guest VM must have a version of the Guest Additions installed which supports symlinks. Currently only the Linux and Oracle Solaris Guest Additions support symlinks.
For security reasons the guest OS is not allowed to create symlinks by default. If you trust the guest OS to not abuse this functionality, you can enable the creation of symlinks for a shared folder as follows:
VBoxManage setextradataVM-name VBoxInternal2/SharedFoldersEnableSymlinksCreate/sharename 1
If a symbolic link is created inside a shared folder on the host and the installed Guest Additions do not support symbolic links then the guest will see the target of the symlink as a file inside the shared folder. For example, if a symlink is created to a file on a Linux host:
$ cd /SharedFolder && ln -s filename symlink-to-filename
When the shared folder is viewed on a Windows guest there
will be two identical files listed,