(NB: adapted from this Ask Ubuntu thread -- tested to work on Ubuntu 16.04 LTS through Ubuntu 22.04 LTS (Jammy).
Unlike using VMWare Tools to enable Linux guest capabilities, the open-vm-tools
package doesn't auto-mount shared VMWare folders. This can be frustrating in various ways, but there's an easy fix.
Install open-vm-tools
and run:
sudo mount -t fuse.vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other
(Make sure /mnt/hgfs
exists and is empty)
You can put configuration stanzas in /etc/fstab
to facilitate this, and then mount /mnt/hgfs
will work.
See the Setting up auto-mounting section for setting up auto-mounting instead.
Make sure open-vm-tools
(and open-vm-tools-desktop
if you're using a desktop environment) are installed, and that you've rebooted after their installation.
sudo apt update
sudo apt install open-vm-tools open-vm-tools-desktop
Make sure you have a /mnt/hgfs
directory made and empty. If not:
sudo mkdir -p /mnt/hgfs
To mount the filesystem, run:
sudo mount -t fuse.vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other
The shared folders will now be in subdirectories of /mnt/hgfs
Add the following line to /etc/fstab
:
.host:/ /mnt/hgfs fuse.vmhgfs-fuse auto,allow_other 0 0
Update: based on extensive testing, the auto
keyword seems to work fine. Prior versions suggested noauto
. If you have trouble with auto
, change to noauto
and see below
- Create or edit the script
/etc/rc.local
(as root), and add the line:
mount /mnt/hgfs
-
make sure
rc.local
is executable and owned by root:sudo chown root:root /etc/rc.local sudo chmod 0755 /etc/rc.local
-
enable the
rc.local
service in systemd:sudo systemctl enable rc-local.service
-
reboot
The rc.local
script runs as the last step of startup, allowing the HGFS filesystem to mount after open-vm-tools
services are running, which is required for successful operation.
Browse /mnt/hgfs
at will.
You're probably better off using autofs rather than putting an entry in fstab. As the author pointed out, bad things can happen if the mount cannot happen at the proper point in the boot process and you have an entry in fstab that for whatever reason can't mount, blowing the boot process out of the water. With autofs, the mount doesn't occur until you actually try to stat below the mount point.
https://www.kernel.org/doc/html/latest/filesystems/autofs.html
sudo mkdir /mnt/autofs
/etc/auto.master.d/hgfs.autofs
with the contents:
/mnt/autofs /etc/auto.mnt
/etc/auto.mnt
with the contents (assuming you didn't rename "Macintosh HD" in OS X):
hgfs -fstype=fuse.vmhgfs-fuse,allow_other .host:/Macintosh\ HD
sudo systemctl enable autofs
sudo systemctl restart autofs
sudo systemctl reload autofs
cd /mnt/autofs/hgfs # fuse file system will mount on this command
sudo ln -s /mnt/autofs/hgfs /mnt
cd /mnt/hgfs # fuse file system will mount on this command