Establishing Host-Guest File Sharing
Ensure VMware Tools is installed on the guest operating system. Create a designated directory on the host machine for data exchange and verify the path.
Verifying and Creating the Mount Point
First, confirm that the virtual machine detects the shared folder configuration.
vmware-hgfsclientCheck if the standard mount directory exists within the file system.
test -d /mnt/hgfs && echo "Exists" || echo "Not found"If the directory is absent, manually create the mount point.
sudo mkdir -p /mnt/hgfsManual Mounting and Permission Handling
Attempt to mount the shared folder. By default, the mount inherits root permissions. To allow the current user to read and write, determine the user ID (UID) and group ID (GID).
MY_UID=$(id -u)
MY_GID=$(id -g)Execute the mount command using the specific permissions to avoid access denied errors.
sudo vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other -o uid=$MY_UID -o gid=$MY_GIDIf the mount fails due to the directory not being empty, include the nonempty flag.
sudo vmhgfs-fuse .host:/ /mnt/hgfs -o nonempty -o allow_other -o uid=$MY_UID -o gid=$MY_GIDConfiguring Automatic Mounting
To persist the configuration across reboots, edit the filesystem table.
sudo nano /etc/fstabInsert the following configuration line at the bottom of the file. Substitute the UID and GID with the values retrieved previously.
.host:/ /mnt/hgfs fuse.vmhgfs-fuse allow_other,uid=1000,gid=1000,umask=022 0 0