系统:Ubuntu 18.04
虚拟机软件:VMware Workstation 15
在终端中使用 apt-get 安装 open-vm-tools
sudo apt-get install open-vm-tools
sudo apt-get install open-vm-tools-desktop
重启后,虚拟机已支持在和 Windows 之间复制黏贴以及拖拉文件到虚拟机桌面。
配置 open-vm-tools进入 /etc/systemd/system 目录并创建文件 mnt.hgfs.service
cd /etc/systemd/system
sudo vim mnt.hgfs.service
写入以下内容
[Unit]
Description=Load VMware shared folders
Requires=vmware-vmblock-fuse.service
After=vmware-vmblock-fuse.service
ConditionPathExists=.host:/
ConditionVirtualization=vmware
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=
ExecStart=/usr/bin/vmhgfs-fuse -o allow_other -o auto_unmount .host:/ /mnt/hgfs
[Install]
WantedBy=multi-user.target
保存后用 systemctl 命令使能这个 service
sudo systemctl enable mnt.hgfs.service
设置 VMware 共享文件夹
打开 VMware 的虚拟机设置界面,在共享文件夹中添加要共享的 Windows 文件夹路径,名称任意一个都行。
然后在 Ubuntu 的路径 /mnt/hgfs 下会出现刚才设置的共享文件夹,如果没有该路径就新建一个
sudo mkdir /mnt/hgfs