-
首先去vmware虚拟机设置共享目录,假设我们共享的目录是
/path/to/share
-
进入虚拟机,安装vmware tool
sudo apt install -y open-vm-tools open-vm-tools-desktop
- 挂载目录
# 1 查看共享的目录
vmware-hgfsclient
# www
# 2 创建hgfs 文件夹
sudo mkdir -p /mnt/hgfs
# 3 用vmhgfs-fuse命令挂载目录
sudo vmhgfs-fuse .host:/ /mnt/hgfs
# 4 此刻 www 目录即 真正挂载到 虚拟机上了
ls /mnt/hgfs
# www
- 开机自动挂载
# 1 执行命令
sudo mount -t fuse.vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other
# 2 添加数据
sudo vim /etc/fstab
# 在末尾另起一行 添加下面一行
.host:/ /mnt/hgfs fuse.vmhgfs-fuse allow_other 0 0
# 3 重新挂载
sudo vmhgfs-fuse .host:/ /mnt/hgfs