之前使用vmware建立的虚拟机要和主机之间共享目录,须要安装官方提供的Vmware Tools
。如今因为linux内核的支持,vmware也将原先Vmware Tools的代码以LGPL协议开放。在debian系中为open-vm-tools,其包含如下工具:linux
内核模块:shell
在客户机中列举出共享目录工具
vmware-hgfsclient
挂载共享目录ui
vmhgfs-fuse -o allow_other -o auto_unmount .host:/<shared_folder> <shared folders root directory>
编辑/etc/fstab,添加以下内容spa
.host:/<shared_folder> /home/user1/shares fuse.vmhgfs-fuse defaults 0 0
将挂载目录的命令写成 Systemd的service
。调试
# /etc/systemd/system/<shared folders root directory>-<shared_folder>.service [Unit] Description=Load VMware shared folders Requires=vmware-vmblock-fuse.service After=vmware-vmblock-fuse.service ConditionPathExists=.host:/<shared_folder> ConditionVirtualization=vmware [Service] Type=oneshot RemainAfterExit=yes ExecStart= ExecStart=/usr/bin/vmhgfs-fuse -o allow_other -o auto_unmount .host:/<shared_folder> <shared folders root directory> [Install] WantedBy=multi-user.target
接着激活该服务。日志