第一步:确认 VMware 共享文件夹已启用
-
关闭虚拟机(Linux)
-
VMware → “虚拟机设置” → “选项” → “共享文件夹”
-
确认:
- ✅ “总是启用”
- ✅ 至少有一个共享文件夹(比如:
D:\share→ 名称如share)
-
点“确定”
🔧 第二步:确认 open-vm-tools 已安装并运行(Ubuntu 20.04+ 默认用这个)
在 Linux 中执行:
sudo apt update
sudo apt install open-vm-tools open-vm-tools-desktop
💡
open-vm-tools-desktop是为了支持自动挂载和拖拽复制(推荐安装)
🔁 第三步:重启虚拟机
sudo reboot
或直接在 VMware 点重启
🧪 第四步:检查 hgfs 是否挂载成功
重启后登录,执行:
vmware-hgfsclient
→ 这个命令会列出你在 VMware 里设置的所有共享文件夹名称!
✅ 如果你看到输出,比如:
share
docs
→ 说明 VMware 共享配置已识别!但还没挂载!
📂 第五步:手动挂载共享文件夹(测试)
sudo mkdir -p /mnt/hgfs/share
sudo /usr/bin/vmhgfs-fuse .host:/share /mnt/hgfs/share -o allow_other -o uid=1000
⚠️ 把
share替换为你在 VMware 里设置的共享文件夹名称(用vmware-hgfsclient查看)
然后:
ls /mnt/hgfs/share
→ ✅ 应该能看到 Windows 共享文件夹里的文件!
🔄 第六步:设置开机自动挂载(永久生效)
编辑 /etc/fstab:
sudo nano /etc/fstab
在最后添加一行:
.host:/share /mnt/hgfs/share fuse.vmhgfs-fuse allow_other,uid=1000,gid=1000,auto_unmount,defaults 0 0
⚠️ 同样,把
share替换为你的共享文件夹名
保存后测试挂载:
sudo mount -a
ls /mnt/hgfs/share
→ 如果没报错 + 有文件,就成功了!
🚫 如果 vmware-hgfsclient 没输出?
→ 说明 VMware Tools 通信异常!
✅ 重启 open-vm-tools 服务:
sudo systemctl restart open-vm-tools
sudo systemctl status open-vm-tools
→ 看是否 active (running)
🐧 Ubuntu 22.04+ 用户注意:
从 Ubuntu 22.04 开始,默认不再自动挂载 hgfs,必须手动配置 fstab!
✅ 最终验证清单:
vmware-hgfsclient→ 能看到共享文件夹名 ❗- 手动挂载 →
ls /mnt/hgfs/你的文件夹→ 能看到文件 ❗ sudo mount -a→ 无报错 ❗- 重启后 → 自动挂载成功 ❗
💡 小技巧:一键查看所有共享 + 挂载状态
echo "=== 共享文件夹列表 ==="; vmware-hgfsclient; echo; echo "=== 当前挂载 ==="; mount | grep hgfs