Skip to content

Instantly share code, notes, and snippets.

@neelabhg
Last active July 1, 2022 13:27
Show Gist options
  • Save neelabhg/0ce451deb748302f588df26c7073b925 to your computer and use it in GitHub Desktop.
Save neelabhg/0ce451deb748302f588df26c7073b925 to your computer and use it in GitHub Desktop.
Simple bash script to mount and unmount shared folders inside Linux guests running on VMware Workstation Player
#!/bin/bash
set -euo pipefail
MOUNTPOINT="$HOME/shares"
mount_shared_folders () {
/usr/bin/vmhgfs-fuse .host:/ "$MOUNTPOINT" \
-o subtype=vmhgfs-fuse \
-o uid=1000 \
-o gid=1000 \
-o umask=0033
}
unmount_shared_folders () {
umount "$MOUNTPOINT"
}
show_available_shared_folders () {
/usr/bin/vmware-hgfsclient
}
print_help () {
echo "Usage: $0 command"
echo "Commands:
m: Mount all shared folders to $MOUNTPOINT
u: Unmount all shared folders
s: Show available shared folders
"
}
if [ "$#" -ne 1 ]; then
print_help
exit 1
fi
case "$1" in
m)
mount_shared_folders
;;
u)
unmount_shared_folders
;;
s)
show_available_shared_folders
;;
*)
print_help
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment