babakin34
Contributor
Contributor

How to change mounted linux directory owner of a VMWare shared folder?

My host OS is Windows 10, my virtual machine is Ubuntu Mate 16.
VMWare version is 12.5.
The mount path looks like this: /mnt/hgfs/{mysharedfolder}.
And it is set to 'root' user/group per default. I want to change it to 'www-data'.

The problem is that none of the proposed methods on internet are working to change the ownership of the shared folder. Apparently with the latest version something changed.

These are what I tried so far:

  • under 'etc/init.d' I edited the 'vmware-tools' file:
# Mount all hgfs filesystems  vmware_mount_vmhgfs() 
{
  if [ "`is_vmhgfs_mounted`" = "no" ];
    then if [ "`vmware_vmhgfs_use_fuse`" = "yes" ];
       then mkdir -p $vmhgfs_mnt vmware_exec_selinux "$vmdb_answer_BINDIR/vmhgfs-fuse \ -o subtype=vmhgfs-fuse,allow_other,uid=33,gid=33 $vmhgfs_mnt"
    else vmware_exec_selinux "mount -t vmhgfs .host:/ $vmhgfs_mnt -o uid=33,gid=33" fi fi
}
  • tried to directly edit '/etc/fstab' and the os didnt boot to GUI anymore, I had to remove the line from command line.

    .host:/{shared-folder} /{path-to-mount-on} vmhgfs defaults,ttl=5,uid=33,gid=33 0 0

  • naive attempts like manually unmounting and remounting the path, using chown or chmod are useless since the system reverts corresponding changes immedietly. Also tried to mount with this:vmhgfs-fuse .host:/ /mnt/hgfs -o uid=1000 -o gid=1000 -o umask=0033

Is there any updated solution to this ?

0 Kudos
0 Replies