原文地址:https://www.woozee.com.cn/article/26.html
1、ubuntu server 14.04
先在虛擬機Ubuntu系統關機的情況下配置好共享文件夾,比如我配置的文件夾是linux_shared。然后開啟Ubuntu並查看有哪些可用的共享目錄:
vmware-hgfsclient
提示linux_shared就是剛才設置好的共享文件夾名稱了。
mount -t vmhgfs .host:/linux_shared /mnt/hgfs
如果提示Error: cannot mount filesystem: No such device就先安裝open-vm-dkms再執行上面的掛載命令
apt-get install open-vm-dkms
2、ubuntu server 18.04
我在ubuntu server 18.04中使用mount -t vmhgfs .host:/linux_shared /mnt/hgfs的方式,會報錯:Error: cannot mount filesystem: No such device。安裝apt-get install open-vm-dkms也不行。所以就使用以下方法了:
vmhgfs-fuse .host:/linux_shared /mnt/hgfs
如果想每次開機都自動掛載,可以把上面這條掛載命令復制到/etc/rc.local中。如果開機后沒有自動執行/etc/rc.local的內容,先檢查一下:
ls -l /bin/sh
如果這個文件鏈接指向的不是/bin/bash而是dash,執行以下命令更換一下就好,下次開機時就會執行/etc/rc.local了。
rm /bin/sh ln -s /bin/bash /bin/sh
注:如果需要更改掛載目錄,可在后面加上uid、pid參數
vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other -o uid=1002 -o gid=1002
