How to Share Files Between Host and VM Using VMware Shared Folders and Samba
This guide explains how to enable VMware's built‑in shared folder feature and set up a Samba server on a Linux virtual machine, providing step‑by‑step commands and configuration details so files can be accessed seamlessly from both host and guest systems.
1. VMware Built‑in Shared Folder Feature
To use VMware's shared folders, first ensure VMware Tools is installed and the VM is restarted. Then follow these steps:
Open Virtual Machine → Settings .
Go to the Options tab and select Shared Folders .
Check Always enabled , then click Add... to choose a host directory (e.g., E:\share).
Finish the wizard; the shared folder will be mounted inside the VM at /mnt/hgfs/share/. You can test by creating /mnt/hgfs/share/test.txt on the VM and confirming it appears on the host.
2. Setting Up a Samba Server
Samba provides SMB/CIFS file sharing across any network, independent of the virtualization platform.
2.1 Install Samba and smbclient
sudo apt-get install samba
sudo apt-get install smbclient2.2 Create a Shared Directory
mkdir ~/share
chmod 777 ~/share2.3 Edit the Samba Configuration
Open /etc/samba/smb.conf with a text editor and add the following share definition:
path = /home/liangxu/share
available = yes
browseable = yes
public = yes
writable = yes2.4 Create a Samba User
sudo touch /etc/samba/smbpasswd
sudo smbpasswd -a liangxuEnter a password when prompted.
2.5 Restart the Samba Service
sudo /etc/init.d/smbd restart2.6 Access the Share from the Host
On Windows, right‑click in any folder, choose Add a network location , and follow the wizard. When prompted for the network address, enter the Samba share path, e.g., \\192.168.0.131\share (replace the IP with the VM's address obtained via ifconfig).
After completing these steps, the Samba share is fully functional; any file created or modified in the shared directory is instantly visible on both the host and the virtual machine.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
