vmhgfs-fuse command. The default mount point is typically /mnt/hgfs, but modern Linux distributions often do not create this directory automatically. You need to manually create the directory, ensure the open-vm-tools package is installed, and then mount the file system using the correct fuse syntax to access your host files from within the virtual machine.
Prerequisites and Configuration
Before attempting to mount the shared folder, you must configure the virtual machine settings correctly. Open VMware Workstation 15, select your target Linux virtual machine, and click on Edit Virtual Machine Settings. Navigate to the Options tab and select Shared Folders. Here, you will see a dropdown menu for "Shared folders." Select the option labeled Always enabled. This ensures that the shared folder is available immediately upon boot, rather than requiring manual intervention each time. Next, add the specific folder from your host operating system (Windows or macOS) that you wish to share. Click the Add button, browse to the desired directory on your host machine, and give it a name. This name is crucial because it becomes the identifier for the shared folder inside the Linux guest. For example, if you name itMyDocs, you will reference this name when mounting.
It is also critical to verify that the open-vm-tools suite is installed and running inside the Linux guest. This service provides the necessary drivers and utilities for VMware features to function. If you are using a minimal installation of Ubuntu, Debian, or CentOS, these tools might not be present by default. Without them, the shared folder functionality will fail silently or produce errors during the mount process.
Installing Required Software
The foundation of shared folder support in Linux guests is theopen-vm-tools package. While older versions of VMware relied on proprietary modules, modern distributions prefer the open-source implementation. Ensure this package is installed before proceeding with any mount commands.
For Debian-based systems like Ubuntu or Linux Mint, use the following command in the terminal:
sudo apt update
sudo apt install open-vm-tools open-vm-tools-desktop
The open-vm-tools-desktop package is optional but recommended as it includes additional features like clipboard sharing and automatic window resizing. For Red Hat-based systems such as CentOS, Rocky Linux, or Fedora, use:
sudo yum install open-vm-tools
# Or for newer DNF based systems:
sudo dnf install open-vm-tools
After installation, restart the virtual machine to ensure the services start correctly. You can verify the service status by running systemctl status vmtoolsd. If the service is active and running, you are ready to proceed with creating the mount point.
Creating the Mount Point
By default, VMware expects shared folders to be mounted at/mnt/hgfs. However, many modern Linux distributions do not create this directory by default, especially in server or minimal installations. Attempting to mount to a non-existent directory will result in an error. Therefore, the first step in the mounting process is to create this directory manually.
Run the following command to create the directory with appropriate permissions:
sudo mkdir -p /mnt/hgfs
The -p flag ensures that parent directories are created if they do not exist and prevents an error if the directory already exists. Once this directory is in place, you have a valid target location for the shared file system. It is important to note that while /mnt/hgfs is the historical standard, some newer configurations may use different paths depending on how the fuse module is configured, but sticking to the default path simplifies troubleshooting and compatibility across different Linux versions.
Mounting the Shared Folder
With the prerequisites met and the mount point created, you can now perform the actual mount operation. VMware uses the FUSE (Filesystem in Userspace) technology to expose host directories to the guest. The command used for this isvmhgfs-fuse.
To mount all shared folders defined in the VM settings, run:
sudo vmhgfs-fuse .host:/ /mnt/hgfs
This command tells the fuse driver to map the .host:/ namespace (which represents all shared folders) to your local /mnt/hgfs directory. After executing this command, navigate to /mnt/hgfs and list the contents. You should see the name of the shared folder you configured earlier (e.g., MyDocs). Accessing this subdirectory will give you read/write access to the corresponding folder on your host machine.
If you only want to mount a specific shared folder rather than all of them, you can specify the folder name explicitly:
sudo vmhgfs-fuse .host:/MyDocs /mnt/hgfs/MyDocs
This method is useful if you have multiple shared folders and want to organize them into separate directories within the guest OS. Remember to adjust the source path (.host:/FolderName) and the destination path according to your specific configuration.
Troubleshooting Common Issues
If the mount fails, check several common pitfalls. First, ensure that theopen-vm-tools service is actually running. Sometimes, after a kernel update or a failed boot, the service may not start automatically. Restarting the service with sudo systemctl restart vmtoolsd can resolve transient issues.
Second, verify that the shared folder is set to "Always enabled" in the VM settings. If it is set to "Disabled" or "Enabled until next power off," the mount point might be empty or inaccessible depending on the current state of the VM.
Third, check for permission errors. If you cannot write to the mounted folder, ensure that your user has the necessary permissions. You can change the ownership of the mount point or the shared folder contents using chown or chmod commands. Additionally, some security policies or SELinux contexts might block access; in such cases, checking the audit logs or temporarily disabling SELinux can help isolate the problem.
For more complex networking or display driver issues that might interfere with overall VM performance, you might find related guidance in articles discussing How to Add the Display Driver Called "-device vmware-svga,id=video0,vgamem_mb=16,bus=pcie.0,addr=0x1" Directly Inside virt-manager or VMWare 17 Player Linux NAT guest can ping but cannot resolve DNS names, although these are distinct from the shared folder mechanism itself.
Frequently Asked Questions
Why is /mnt/hgfs empty after mounting?
This usually indicates that the shared folder is not enabled in the VM settings or the open-vm-tools service is not running. Verify that the shared folder is set to "Always enabled" in the VMware options and check the status of the vmtoolsd service.
Can I mount a shared folder permanently without typing the command every time?
Yes, you can add the mount command to your /etc/fstab file or create a systemd unit to automate the process. However, since the mount depends on the VMware tools running, it is often safer to rely on the auto-mount feature provided by the tools themselves once properly configured.
What if I get a "Permission denied" error when trying to write to the folder?
This is likely due to file ownership settings. The files appear to be owned by root by default. You can change the ownership of the mounted directory to your user using the chown command, or adjust the permissions using chmod.
Does this work with VMware Player as well as Workstation?
Yes, the procedure is identical for VMware Player and Workstation. Both applications use the same underlying open-vm-tools infrastructure for shared folders. Just ensure that the shared folder feature is enabled in the player's VM settings.
How do I unmount the shared folder?
You can unmount the folder using the standard umount command followed by the mount point path, for example: sudo umount /mnt/hgfs. Note that unmounting may stop access to the shared data until it is remounted.