Mounting VMware Shares from the Command Line on Linux VM (2024)

In this article, I am going to show you how to share a directory/folder to a VMware Virtual Machine (VM) and how to mount the VMware share from the command line on a Linux VMware Virtual Machine (VM). So, let’s get started.

Adding a Share to the VMware VM:

To share a directory/folder from the host to a VMware VM, open the VM, make sure the VM is not powered on and go to VM > Settings.

Then, go to the Options tab and click on Shared Folders.

By default, Shared Folders is Disabled. To enable Shared Folders, select Always enabled.

Now, you can add shared folders. To add a shared folder, click on Add…

Now, click on Next.

Now, click on Browse to select a directory/folder from your host computer.

Select a directory/folder that you want to share to the VMware VM and click on OK.

If you want to create a new directory, select a directory (parent) where you want to create a new directory, type in a Folder name and click on Make New Folder. Once the directory/folder is created, you should be able to select it for sharing.

By default, the Name of the shared folder should be the name of the directory you’ve selected. If you want, you can change it. I recommend you not to add spaces in the share Name.

Once you’re done, click on Next.

Make sure Enable this share checkbox is checked.

If you want this share to be read only, check the Read-only checkbox.

Once you’re done, click on Finish.

The share should be added to the VM.

If you want to remove a share, select it and click on Remove.

If you want to change any property of the share, select the share and click on Properties.

You can modify the Name, the Host path, share attributes from here. Once you’re done, click on OK for the changes to take effect.

Now, click on OK.

Now, power on the virtual machine.

The virtual machine should start.

Installing Open VM Tools:

In order to mount VMware shares on Linux, you must have Open VM Tools or VMware Tools installed on your Linux VM.

If you’re using a Ubuntu/Debian or any Ubuntu/Debian based operating system in the VMware VM, then check How to Install VMware Tools on Ubuntu/Debian VMware Virtual Machine.

If you’re using CentOS/RHEL 8, then check How to Install VMware Tools on CentOS/RHEL 8 VMware Virtual Machines.

Mounting VMware Shares on Linux VM:

First, make a directory (let’s say ~/testshare) on the Linux VM where you want to mount the VMware share with the following command:

$ mkdir ~/testshare

The command to mount a VMware share on a Linux VM is:

$ sudo mount -t fuse.vmhgfs-fuse -o ><MountOptions> .host:/<VMwareShareName> <MountPathOnVM>

To mount the VMware share testshare on the ~/testshare directory, run the following command:

$ sudo mount -t fuse.vmhgfs-fuse .host:/testshare~/testshare

The VMware share testshare should be mounted on the ~/testshare directory.

By default, the VMware shares mounted on the Linux VM is only accessible to the root user as you can see in the screenshot below. I will show you how to solve this problem. So, don’t worry.

You can unmount the VMware share mounted in the ~/testshare directory with the following command:

$ sudo umount ~/testshare

To allow any user on the Linux VM to access the mounted VMware share, use the allow_other mount option while mounting the VMware share.

$ sudo mount -t fuse.vmhgfs-fuse -o allow_other .host:/testshare ~/testshare

Now, you should be able to access the mounted VMware share without sudo or superuser privileges.

But, the files and directories on the share are still owned by root.

If you want the VMware share files to be accessible to your login user and also be owned by your login user, then mount the VMware share with the uid and gid mount options as follows:

$ sudo mount -t fuse.vmhgfs-fuse -o allow_other,uid=$(id -u),gid=$(id -g)
.host:/testshare ~/testshare

As you can see, the VMware share files and directories are now accessible to my login user and also owned by my login user.

Automatically Mount VMware Shares:

If you want the VMware Linux VM to automatically mount the VMware share on boot, then you have to add a new line to the /etc/fstab file.

First, open the /etc/fstab file with the following command:

$ sudo nano /etc/fstab

You may want to use vi text editor for editing the /etc/fstab file. In that case, run the following command:

$ sudo vi /etc/fstab

Or,

$ sudo vim /etc/fstab

Now, add the following line at the end of the /etc/fstab file:

.host:/<VMwareShareName><MountDirectoryOnVM>fuse.vmhgfs-fuse
allow_other,uid=<YourUserID>,gid=<YourGroupID> 00

Note: Make sure to replace <VMwareShareName>, <MountDirectoryOnVM>, <YourUserID> and <YourGroupID>.

You can find <YourUserID> with the id -u command and <YourGroupID> with the id -g command.

In my case, I added to the following line to the /etc/fstab file:

.host:/testshare /home/shovon/testshare fuse.vmhgfs-fuse
allow_other,uid=1000,gid=1000 0 0

Once you’re done, save the /etc/fstab file.

Now, reboot your Linux VM with the following command:

$ sudo reboot

Once your Linux VM starts, run the following command to verify whether the VMware share is mounted on the Linux VM:

$ df -h | grep <VMwareShareName>

As you can see, the VMware share testshare is mounted correctly in the ~/testshare directory.

I can access the VMware share as usual.

So, that’s how you share a directory/folder from the host to your Linux VMware VM and mount it from the command line on your Linux VM. Thanks for reading this article.

Mounting VMware Shares from the Command Line on Linux VM (2024)

FAQs

How do I mount a shared folder in VMware? ›

For this, you need to go to the virtual machine library in the VMware workstation, click on the virtual machine settings, and enable folder sharing. You must follow the same steps to share a folder between a host system and a virtual machine and among multiple virtual machines.

How to share a folder from VMware to Linux? ›

Navigate to the VM settings in your VMware software. Head to the “Options” tab and pick “Shared Folders.” Choose “Always enabled” and then click on “Add” to select a folder on your host machine you'd like to share.

How to start VMware player from command line Linux? ›

Choose VMware Player from the Start > Programs menu in Windows, or from the corresponding program menu in a Linux X windows session. From a command line, type: In Windows, enter <path>vmplayer.exe In Linux, enter <path>vmplayer where <path> is the appropriate path on your system to the application file.

What does it mean to mount a shared folder? ›

Mounting is a process by which a computer's operating system makes files and directories on a storage device (such as hard drive, CD-ROM, or network share) available for users to access via the computer's file system.

How to share files between VM and host VMware? ›

Select the virtual machine and select Virtual Machine > Virtual Machine Settings. On the Options tab, select Shared Folders. Select a folder sharing option. Keep folder sharing enabled, even when the virtual machine is shut down, suspended, or powered off.

How to run VMware from command line? ›

The main command-line program used to stop and start VMware Workstation Virtual machines is the vmrun command. If you open the Windows cmd prompt and change directory to C:'Program Files'VMware'VMware Server. Once there, type vmrun and press Enter.

How to use VMware in terminal? ›

Right-click the virtual machine and select Guest OS > Install VMware Tools... or Guest OS > Upgrade VMware Tools... In the virtual machine, open a terminal window. Run the mount command with no arguments to determine whether your Linux distribution automatically mounted the VMware Tools virtual CD-ROM image.

How do I mount a shared folder in Linux Mint VirtualBox? ›

Go to Settings -> Shared Folders and add your folder path/name, and select Auto-mount. Then start your machine and mount the guest additions with Devices -> Insert Guest Additions CD.

Top Articles
Latest Posts
Article information

Author: Fr. Dewey Fisher

Last Updated:

Views: 6053

Rating: 4.1 / 5 (62 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Fr. Dewey Fisher

Birthday: 1993-03-26

Address: 917 Hyun Views, Rogahnmouth, KY 91013-8827

Phone: +5938540192553

Job: Administration Developer

Hobby: Embroidery, Horseback riding, Juggling, Urban exploration, Skiing, Cycling, Handball

Introduction: My name is Fr. Dewey Fisher, I am a powerful, open, faithful, combative, spotless, faithful, fair person who loves writing and wants to share my knowledge and understanding with you.