報錯顯示掛載點 /mnt/hgfs
不存在,你需要先創建這個目錄。可以按照以下步驟進行操作:
-
創建掛載點目錄:
sudo mkdir -p /mnt/hgfs
-
手動掛載共享文件夾:
sudo vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other
-
確保每次啟動時自動掛載:
編輯
.bashrc
文件,確保在每次啟動時自動掛載:vim ~/.bashrc?
或者?nano ~/.bashrc
-
-
在文件末尾添加以下命令:
sudo vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other
-
保存并退出
nano
:按Ctrl + O
保存文件??按Enter
確認? ? ? 按Ctrl + X
退出 -
確保
fusermount
命令在啟動時不需要密碼:編輯
/etc/sudoers
文件:sudo visudo
在文件末尾添加以下內容:
%sudo ALL=(ALL:ALL) NOPASSWD: /usr/bin/vmhgfs-fuse
-
重啟系統:
重啟系統后,您應該能夠在
/mnt/hgfs
目錄下看到共享文件夾的內容:sudo reboot
如果您不希望編輯 .bashrc
文件,可以選擇使用 rc.local
文件,這樣更適合系統級別的掛載操作:
-
編輯
rc.local
文件:sudo vim /etc/rc.local
在文件中添加掛載命令,并確保
rc.local
文件以exit 0
結尾:#!/bin/sh -e sudo vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other exit 0
-
確保
rc.local
文件具有執行權限:sudo chmod +x /etc/rc.local
這樣可以確保掛載命令在每次系統啟動時自動執行。