9

I need vmhgfs to be accessible to both root user and the www-data user.

As root, I run the vmhgfs-fuse .host:/ /mnt/hgfs/ command in rc.local

However, the webserver is unable to read the shared folder. So I checked its permission,

www-data@ubuntu16:~$ ls /mnt/ -lh
ls: cannot access '/mnt/hgfs': Permission denied
total 0
d????????? ? ? ? ?            ? hgfs
www-data@ubuntu16:~$

(The permission if /mnt is 777)

I don't know what's happening. Looks like a kernel issue. It never happened in Ubuntu 14.04, now in 16.04 and kernel 4.4.0-21-generic, it became so.

P.S If I mount the hgfs with www-data account, it's then accessible by www-data, but not by root user.

daisy
  • 53,527
  • 78
  • 236
  • 383

3 Answers3

12

Resolved. Use allow_other option to grant access

vmhgfs-fuse -o allow_other .host:/ /mnt/hgfs
daisy
  • 53,527
  • 78
  • 236
  • 383
  • This fixed my issue of nginx, running in my Alpine Linux VMware Fusion, not being able to access the mounted share at `/var/www/site` even with user:group set correctly and permissions 777 – Chris V Apr 11 '19 at 09:17
3

To add to daisy's answer:

If you want this change to survive a reboot put it in your /etc/fstab file, e.g.

.host:/ /mnt/hgfs fuse.vmhgfs-fuse allow_other,defaults 0 0

EM0
  • 436
  • 5
  • 15
2

If you are trying this on a macOS Big Sur (running VMware Fusion 12) or later and Ubuntu 18.x+, make sure to check out the new configuration options from vmhgfs-fuse:

vmhgfs-fuse --help

and set your /etc/fstab accordingly:

sudo vmhgfs-fuse -o allow_other,default_permissions,uid=1000,gid=1000 .host:/ /mnt/hgfs

However for some reason, fstab does not set the permissions correctly after reboots (probably overwritten by the configuration found in /etc/systemd/system/mnt-hgfs.mount).

So once I modified the file /etc/systemd/system/mnt-hgfs.mount and added the Options parameter in section Mount, everything worked fine after reboots.

[Unit]
Description=VMware mount for hgfs
DefaultDependencies=no
Before=umount.target
ConditionVirtualization=vmware
After=sys-fs-fuse-connections.mount

[Mount]
What=vmhgfs-fuse
Where=/mnt/hgfs
Type=fuse
Options=default_permissions,allow_other,uid=1000,gid=1000

[Install]
WantedBy=multi-user.target
RodrigoM
  • 121
  • 2