【VMware】开启「共享文件夹」
✅ 一、确认 VMware 设置里启用了共享文件夹
- 关闭虚拟机电源(完全关机,不是暂停!)
 - 在 VMware 主界面中: 
- 右键你的虚拟机 ➜ 设置(Settings)
 - 选择 “选项”(Options)标签页
 - 点击左侧 “共享文件夹(Shared Folders)”
 - 勾选: 
- ✅ 开启共享文件夹(Enable Shared Folders)
 - ✅ 总是启用(Always enabled)
 
 - 添加一个你主机上的目录,取名如 
vmshare 
 
✅ 然后重新启动虚拟机。
✅ 二、确认 VMware Tools 安装成功
你用的是 Linux 系统(比如 Ubuntu),运行以下命令安装:
sudo apt update
sudo apt install open-vm-tools open-vm-tools-desktop -y
sudo reboot
 
✅ 三、手动挂载共享目录(若 /mnt/hgfs 为空)
 
即使设置好了,有时候不会自动挂载,我们手动来做:
- 创建挂载点(如果不存在):
 
sudo mkdir -p /mnt/hgfs
 
- 手动挂载共享目录:
 
sudo vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other
 
- 查看共享目录:
 
ls /mnt/hgfs/
 
你应该看到你设置的共享名,比如 vmshare。
✅ 四、测试拷贝文件
假设你要把虚拟机里的文件拷到 Windows 的共享目录:
cp ~/project.zip /mnt/hgfs/vmshare/
 
然后你可以在 Windows 的共享目录(比如 D:\VMFiles)看到它。
🧠 可选:设置开机自动挂载(更方便)
编辑文件:
sudo nano /etc/fstab
 
添加一行:
.host:/ /mnt/hgfs fuse.vmhgfs-fuse allow_other 0 0
 
保存并退出(Ctrl + O,然后 Ctrl + X)
❗ 如果 vmhgfs-fuse 命令未找到?
 
运行:
sudo apt install open-vm-tools open-vm-tools-desktop -y
 
它会安装 vmhgfs-fuse 工具。
