Enable Shared Folders Between a Host Computer and a Virtual Machine
Learn how to configure, mount, test, secure, and troubleshoot shared folders between a host computer and Linux or Windows virtual machine.
What a Virtual-Machine Shared Folder Is
A host is the physical computer and operating system running virtualization software. A guest is the operating system running inside the virtual machine. A virtual machine is a software-defined computer provided by a virtualization platform such as VirtualBox, VMware, or Hyper-V.
A shared folder is a selected directory on the host that the virtualization platform exposes inside the guest. The files remain on the host filesystem, but the guest can access them through a mount point, file manager location, or mapped drive.
Shared folders are useful for moving installers, exchanging documents, sharing source code, and keeping important files outside the virtual machine disk. Changes made through a read-write share normally affect the same files stored on the host.
Shared folders compared with other integration features
| Feature | How it differs from a shared folder |
|---|---|
| Network file share | Uses a network protocol such as SMB or NFS. It can work between separate computers, while a virtualization shared folder uses guest integration features. |
| Drag and drop | Transfers selected items through the virtualization interface instead of presenting a persistent directory. |
| Shared clipboard | Shares text or sometimes other clipboard content, not a filesystem directory. |
| USB passthrough | Attaches a physical USB device to the guest. It does not expose a host directory directly. |
| Virtual disk mounting | Gives the guest access to a virtual disk or partition. A shared folder instead exposes a host directory through integration software. |
Prerequisites and Compatibility
- Know which virtualization platform and version runs the VM.
- Power off the VM before changing settings unless the platform supports adding a share through the running VM's device menu.
- Confirm that the guest operating system is supported by the platform's shared-folder feature.
- Install the appropriate guest integration software. VirtualBox generally uses Guest Additions; VMware generally uses VMware Tools or compatible open-vm-tools packages.
- Confirm that the host directory exists and that the host account, and the virtualization process running for that account, can read or write it.
- Have administrator privileges in a Windows guest or
sudoaccess in a Linux guest when installing tools or changing group membership.
Guest integration software supplies drivers, filesystem modules, and utilities that allow the guest to communicate with the virtualization platform. Configuring a host path alone usually does not make the folder visible to the guest.
Plan the Host Folder Safely
Create a dedicated directory such as VM-Exchange rather than sharing an entire home directory, user profile, or system drive. Put only the files the guest needs in that directory.
Choose permissions deliberately:
- Read-only: The guest can view or copy files but cannot change the host files through the share. This is suitable for installers, reference data, and untrusted guests.
- Read-write: The guest can create, edit, rename, and delete files if both the share and host filesystem permissions allow those operations.
Configure the Share in VM Settings
The exact labels differ between products, but the workflow is usually the same:
- Open the virtualization manager and select the VM.
- Open Settings or the running VM's Devices menu.
- Find Shared Folders, Shared Folder Settings, or the equivalent integration section.
- Add a new share and select the host directory as the host path.
- Enter a short share name. Avoid spaces and use the exact spelling later when mounting manually.
- Select read-only or read-write access.
- Enable auto-mount if the share should be mounted automatically when the guest starts.
- Enable persistent or permanent if the configuration should remain attached after shutdown and restart.
- Save the settings and start, or restart, the guest as required.
| Option | Purpose | Recommended use | Security consideration |
|---|---|---|---|
| Host path | The directory physically stored on the host. | Use a dedicated exchange directory. | Everything in this directory may become visible to the guest. |
| Share name | The guest-side name used to identify the share. | Use a short, clear name without spaces when possible. | Do not assume it is the same as the host directory name. |
| Mount point | The location where the share appears in the guest filesystem. | Use the platform's default or a controlled directory. | Protect the mount point with suitable guest permissions. |
| Read-only | Prevents guest writes through the share. | Enable unless guest write access is necessary. | Reduces accidental or malicious host-file changes. |
| Auto-mount | Mounts the share automatically during guest startup. | Use for frequently accessed folders. | Files become available to guest programs at startup. |
| Persistent/permanent | Saves the share with the VM configuration. | Use when the share should survive VM restarts. | Remove it when the exchange is complete or no longer trusted. |
Changing or removing a share
Stop applications that may be using the folder before editing or removing it. In the VM's shared-folder settings, select the share, then edit its host path, permissions, or name, or remove it. A removed share does not normally delete the host directory, but verify the platform's confirmation dialog before accepting.
When the VM is powered down, settings changes are usually available from the normal configuration window. Some platforms also allow a share to be added while the VM is running through a virtual device or integration menu. A running-VM change may be temporary unless saved as a persistent share.
Install Guest Integration Software
Linux guests
For a Linux guest, install the integration package supplied or recommended by the virtualization platform and guest distribution. In VirtualBox, this is commonly the Guest Additions image and its installer. In VMware, it may be VMware Tools or the distribution's open-vm-tools packages.
- Start the guest and attach or select the platform's guest-tools installer.
- Run the installer with the required administrator privileges.
- Allow it to build or load filesystem modules if prompted.
- Restart the guest, or log out and back in if the distribution only requires a session refresh.
Tools must match the virtualization product and should be kept compatible with the guest kernel. After a guest kernel or virtualization-platform update, the integration modules may need to be rebuilt or updated.
Windows guests
In a Windows guest, attach the VirtualBox Guest Additions or VMware Tools installer supplied by the platform, run it as an administrator, accept the required drivers, and restart Windows when prompted. If shared folders stop working after a platform update, update or repair the guest tools as well.
Access a Shared Folder from a Linux Guest
Open the guest file manager and inspect locations such as Other Locations, Computer, or the filesystem root. Common default locations include:
- VirtualBox:
/media/sf_<share-name> - VMware:
/mnt/hgfs, often with a subdirectory for each share
Use the terminal to inspect mounted shared filesystems:
mount | grep -E 'vboxsf|hgfs'For VirtualBox, the current Linux user commonly needs membership in the vboxsf group:
sudo usermod -aG vboxsf "$USER"Log out and back in, or reboot, before the new group membership takes effect. Confirm the group with:
idLook for vboxsf in the group list. If the share is configured but auto-mount did not occur, create a mount point and mount it manually:
sudo mkdir -p /mnt/vm-exchange
sudo mount -t vboxsf <share-name> /mnt/vm-exchangeReplace <share-name> with the exact configured name. For VMware guests, a supported tools installation may allow manual mounting with:
sudo vmhgfs-fuse .host:/ /mnt/hgfs -o allow_otherThe VMware command depends on the VMware product, guest distribution, and installed tools version. If it fails, verify the tools package and consult the guest's supported integration method before adding permanent mount configuration.
Example: VirtualBox host folder and Ubuntu guest
- Create a dedicated host directory named
VM-Exchange. - In the VM's Shared Folders settings, add that directory.
- Set the share name to
vmexchange, enable auto-mount, and choose read-only or read-write access. - Install VirtualBox Guest Additions in Ubuntu and restart the guest.
- Open
/media/sf_vmexchangein the file manager or terminal. - If access is denied, run the
usermodcommand above, then log out and back in. - Create a harmless test file in the guest share and verify that it appears in the host's
VM-Exchangedirectory.
Access a Shared Folder from a Windows Guest
After the guest tools are installed, open File Explorer. The share may appear under Network, This PC, or a virtualization-specific shared-folder location. Some products present it as a network-style location or provide a UNC-style path.
If the platform supplies a path, you can enter it in File Explorer's address bar. To assign a drive letter, open This PC, choose Map network drive, select a letter, and enter the supplied shared-folder path. The command-line form is:
net use Z: <shared-folder-network-path>Replace the placeholder with the exact path shown by the virtualization platform. The path varies by product and configuration, so do not assume that every VMware or VirtualBox installation uses the same UNC name.
If the share is read-only, Windows may allow opening and copying files but reject creation, editing, or deletion. If the host directory is inaccessible to the host account or the virtualization process, the guest may show an empty location or an access error.
Example: VMware host folder and Windows guest
- Open the VM settings and enable shared folders.
- Select a narrowly scoped host directory and assign a share name.
- Install or update VMware Tools in the Windows guest, then restart if requested.
- Check File Explorer under Network and This PC.
- Map the location to a drive letter if convenient.
- Create a test file only if read-write access was intentionally selected, then confirm the result on the host.
Validate Transfer and Persistence
- Create a harmless text file such as
shared-folder-test.txton the host. - Confirm that it appears in the guest's mounted folder or mapped drive.
- Open it in the guest and, if permitted, add a test line.
- Confirm the changed content on the host.
- Restart the guest and check whether the share is still present.
- Confirm that the file remains on the host even when the VM is powered off.
A persistent share configuration should return after a guest restart, while an auto-mounted share should be attached automatically at startup. The files themselves are not stored in the guest disk merely because the guest can access them.
Security and Safe Usage
- Use read-only mode for installers, reference material, and untrusted guests.
- Share only the files required for the current task.
- Do not expose operating-system directories, credential stores, private keys, password databases, or an entire user profile.
- Remember that guest applications can modify host files through a read-write share.
- Scan files copied in either direction and retain ordinary host backups.
- Remove the share after a one-time transfer, especially when the guest is untrusted.
Typical Locations by Platform
| Platform | Guest integration requirement | Typical Linux location | Typical Windows access method |
|---|---|---|---|
| VirtualBox | VirtualBox Guest Additions | /media/sf_<share-name> | File Explorer integration or a platform-provided shared-folder location |
| VMware Workstation/Fusion | VMware Tools or compatible open-vm-tools | /mnt/hgfs | File Explorer, a UNC-style location, or a mapped drive |
| Hyper-V | Shared-folder behavior depends on the guest and integration method; Enhanced Session Mode or an SMB share may be used instead | No single universal shared-folder path | Enhanced Session resource redirection or a separately configured Windows network share |
Hyper-V does not provide one universal shared-folder mechanism identical to VirtualBox or VMware. Use the integration method supported by the guest and Hyper-V configuration, and distinguish it from a normal network file share.
Troubleshooting Shared-Folder Failures
| Symptom | Likely cause | Resolution |
|---|---|---|
| Folder does not appear | Guest tools are missing, the share is disabled, the host path no longer exists, or the guest has not restarted. | Check the VM configuration and host path, install or repair Guest Additions or VMware Tools, restart the guest, and inspect mounted filesystems. |
| Permission denied | The Linux user lacks required group membership, or host and guest permissions block access. | For VirtualBox, check membership in vboxsf, log out and in, and verify host directory permissions. |
| Auto-mount missing | Auto-mount is disabled, the integration module failed after a kernel update, or the share is not persistent. | Enable auto-mount, update or reinstall guest tools, reboot or log in again, and test a manual mount. |
| Read-only behavior | The share was configured as read-only, or host filesystem permissions prevent writes. | Check the share option, host permissions, available host disk space, and the account used by the guest application. |
| Guest tools installation fails | The tools do not match the platform, guest OS, or current kernel. | Use the platform's matching tools, install required build components where applicable, update the tools, and verify guest OS support. |
Separate a mount problem from a host-permission problem
If mount | grep -E 'vboxsf|hgfs' returns nothing, the problem is likely integration, configuration, or mounting. Check the share name, auto-mount setting, guest tools, and platform support.
If the share is mounted but opening or writing files fails, investigate guest permissions, Linux group membership, read-only configuration, host filesystem permissions, host disk space, and the identity used by the guest application.
- Confirm that the configured host path still exists and has not been renamed or moved.
- Check the exact share name, including capitalization where the platform or guest filesystem treats names as case-sensitive.
- After changing group membership or installing tools, log out and in or reboot.
- After a guest kernel update, verify that the integration module matches the new kernel.
- For Windows, check both Network and This PC, then try the platform-provided path or mapped drive.
- Check Windows security software or policy restrictions if discovery is blocked.
Exam-Relevant Notes
- The host owns the physical directory; the guest receives an integrated view of it.
- Guest Additions or VMware Tools are normally required before the guest can use the configured share.
- A mount point is the guest filesystem location where the share appears.
- Auto-mount controls startup mounting; persistent controls whether the share configuration remains saved with the VM.
- VirtualBox Linux users commonly need the
vboxsfgroup. - Read-only protects host files from guest writes but does not make transferred files inherently safe.
- A shared folder is not the same as a network file share, clipboard sharing, drag and drop, USB passthrough, or virtual disk mounting.