之前使用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
接着激活該服務。日誌