How do I mount shared folders in Ubuntu using VMware tools?

Experts. I've successfully installed VMware tools for Ubuntu. Everything seems to work fine, but shared folders were not mounted automatically.
How do I get them to work?

If I run vmware-hgfsclient in terminal, I get the list of shared folders, but ls -l /mnt/hgfs is empty. Actually there's no hgfs dir in /mnt. I know I should probably use the vmware-hgfsclient tool, but I realy don't know how.

P.S. I wouldn't ask if I could understand the vmware-hgfsclient help I've read.

Any suggestions?


Solution 1:

Most other answers are outdated. For Ubuntu 18.04 (or recent Debian distros), try:

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

If the hgfs directory doesn't exist, try:

sudo vmhgfs-fuse .host:/ /mnt/ -o allow_other -o uid=1000

You may have use a specific folder instead of .host:/. In that case you can find out the share's name with vmware-hgfsclient. For example:

$ vmware-hgfsclient
my-shared-folder
$ sudo vmhgfs-fuse .host:/my-shared-folder /mnt/hgfs/ -o allow_other -o uid=1000

If you want them mounted on startup, update /etc/fstab with the following:

# Use shared folders between VMWare guest and host
.host:/    /mnt/hgfs/    fuse.vmhgfs-fuse    defaults,allow_other,uid=1000     0    0

I choose to mount them on demand and have them ignored by sudo mount -a and the such with the noauto option, because I noticed the shares have an impact on VM performance.

Requirements

Software requirements may require installing the following tools beforehand:

sudo apt-get install open-vm-tools open-vm-tools-desktop

Others have claimed the following are required:

sudo apt-get install build-essential module-assistant \
  linux-headers-virtual linux-image-virtual && dpkg-reconfigure open-vm-tools

Solution 2:

I have set up on Windows 7 host with Ubuntu 11.04 Desktop with VMware Tools installed on.

Virtual Machine settings

  • Folder sharing = Always Enabled
  • Make sure you have at least one Folder shared between the host and guest

On the Ubuntu Guest

  • check /mnt/hgfs that you can access your shared folder.

    If you don't see your shared folders (automounted) inside /mnt/hgfs , run VMware configuration tools:

    sudo vmware-config-tools.pl

  • update your fstab using the details below:

    gksu gedit /etc/fstab

    (I am using ubuntu desktop so use other text editor to enter the next line at the end of the file)

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

  • Restart your vm (You may need to restart few times or get error message saying unable to mount just skip the error and restart)

Solution 3:

run vmware-config-tools.pl, AGAIN!

Refer: http://www.laotudou.com/vmware-player-share-folder.html

Solution 4:

[UPDATE 2017-05-18] This answer is outdated for Ubuntu newer than 15.10 (Wiley). The executable vmware-hgfsmounter has not been available in Ubuntu since 16.04LTS (xenial). Although, hgfsmounter may still be available on other Linux distributions, since the hgfsmounter function is still currently available in the upstream source code on GitHub. If anyone has updated information, please comment or edit this answer, instead of down-voting, as I believe this answer may still be valid for older Ubuntu releases.

This answer also assumes that you are not using VMWare Tools from VMWare but instead using open-vm-tools from your Linux distribution. VMWare decided to support this switch in 2015. See KB2073803. Therefore this answer also assumes that your version of Ubuntu can install the open-vm-tools from it's software repository.

OUTDATED FOR UBUNTU > 15.10 (Wiley)

This worked for me using open-vm-tools from Ubuntu Software Center (trusty-14.04LTS shown - please see update above):

cd /mnt
sudo mkdir hgfs
sudo vmware-hgfsmounter .host:/`vmware-hgfsclient` /mnt/hgfs

assuming of course that I had already enabled a shared folder from the host machine in VMware Player settings.

Note that vmware-hgfsclient returns the list of shared folders that are enabled in the VMware Player settings. This function is available for both open-vm-tools and vmware-tools.

Also note that vmware-hgfsmounter is equivalent to

mount -t vmhgfs .host:/win7share /mnt/hgfs

or to adding to your /etc/fstab file

.host:/win7share /mnt/hgfs vmhgfs defaults 0 0

But the vmware-hgfsmounter function is not available using the official vmware-tools from VMware that ships with the current VMware player. Therefore, as the currently accepted answer suggests, running the vmware-config-tools.pl -d fixes the problem.

Solution 5:

I had a similar problem. The folder /mnt/hgfs/ appeared back again when I assured that open-vm was uninstalled. As follows

sudo apt-get purge open-vm-tools
sudo apt-get purge open-vm-tools-dkms

and reinstalled vmware-tools