VMware Mounting Shared Folder in Linux Guest
UPDATED: March 23rd, 2020
Anyone who’s used VMware at a desktop level for a while has likely run into the need to share a file from the guest operating system back to the host operating system.
This post will cover options for Debian derivatives which include Ubuntu.
Make sure you have enabled the file share in your VMware virtual machine settings.
Now, you now have two options.
The first (and not covered in this post) is to install the VMware native tools software. While this is possible (there are lots of guides) this will have to be redone each time you update your kernel; this can happen pretty often now-a-days.
Unless you have other reasons to use VMware specific tools, you will likely get equivalent mileage out of the open-vm-tools packages which is the second option.
In the latest versions of Ubuntu 18.04 LTS if running inside a virtual environment it will likely install everything you need by default. If not, you’ll need to still install some things. What you need to install may vary by distro.
For a desktop environment I tend to install the following packages to cover the bases…
apt-get install open-vm-tools open-vm-tools-desktop open-vm-tools-dkms
This will get you the base package and you should probably reboot for good measure after this, especially if you just enabled file sharing for the virtual machine.
Once back up, you have two steps to get access to your shared folder.
1. Create the mount point path
mkdir -p /mnt/hgfs/yoursharename
2. Mount the share
vmhgfs-fuse .host:yoursharename /mnt/hgfs/yoursharename
You should now be able to browse to, or cd to your mounted share folder.
Troubleshooting – Did you do this as root? 😉
Troubleshooting – This method will not persist through reboot.
Over the years since I wrote this I found another couple useful options for mounting guest folders that I’ve included below.
By default mounting a folder using root (which you must do) will result in that folder being ONLY available to root which may not be ideal. To get around this, mount using the “allow_other” flag shown below.
vmhgfs-fuse -o allow_other .host:/yoursharename /mnt/hgfs/yoursharename
Another method of mounting shares is to call the
mount command directly as shown below.
mount -t vmhgfs .host:/yoursharename /mnt/hgfs/yoursharename
That’s all for now.