VMWare Shared Folder Set Ownership

By Tyler on

The problem with VMWare shared folders is that you can’t specify the owner/group so the default ends up being root for both. This isn’t ideal, for instance, if we’re sharing web files that need to be owned by Apache in order to be served. Piggybacking off a comment from this post, here’s how to specify the owner/group of a shared folder:

  1. Ensure VMWare Tools is installed.
  2. Execute:
    sudo echo ".host:/ /mnt/hgfs vmhgfs rw,uid=33,gid=33" >> /etc/fstab
    sudo umount /mnt/hgfs
    sudo mount /mnt/hgfs

What this does is append /etc/fstab to specify how /mnt/hgfs should be mounted in terms of ownership. uid and gid 33 is Apache’s www-data user on Debian-based distrobutions. /mnt/hgfs is then re-mounted with new ownership.