报错显示挂载点 /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
这样可以确保挂载命令在每次系统启动时自动执行。


















