VM虚拟机共享文件夹fuse: bad mount point `/mnt/hgfs‘: No such file or directory

报错显示挂载点 /mnt/hgfs 不存在,你需要先创建这个目录。可以按照以下步骤进行操作:

  1. 创建挂载点目录

    sudo mkdir -p /mnt/hgfs

  2. 手动挂载共享文件夹

    sudo vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other

  3. 确保每次启动时自动挂载

    编辑 .bashrc 文件,确保在每次启动时自动挂载:

    vim ~/.bashrc 或者 nano ~/.bashrc

  4. 在文件末尾添加以下命令:

    sudo vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other

  5. 保存并退出 nano:按 Ctrl + O 保存文件 按 Enter 确认 按 Ctrl + X 退出

  6. 确保 fusermount 命令在启动时不需要密码

    编辑 /etc/sudoers 文件:

    sudo visudo

    在文件末尾添加以下内容:

    %sudo ALL=(ALL:ALL) NOPASSWD: /usr/bin/vmhgfs-fuse

  7. 重启系统

    重启系统后,您应该能够在 /mnt/hgfs 目录下看到共享文件夹的内容:

    sudo reboot

如果您不希望编辑 .bashrc 文件,可以选择使用 rc.local 文件,这样更适合系统级别的挂载操作:

  1. 编辑 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

  2. 确保 rc.local 文件具有执行权限

    sudo chmod +x /etc/rc.local

这样可以确保挂载命令在每次系统启动时自动执行。

相关推荐
orion572 天前
Missing Semester Class1:course overview and introduction of shell
linux
用户120487221612 天前
Linux驱动编译与加载
linux·嵌入式
用户805533698032 天前
Input 子系统架构:Core、Handler、Driver 三层是怎么协作的
linux·嵌入式
用户805533698032 天前
RK-Forge外设系列开篇 - 把板子从「能启动」变成「能用」:Ethernet/SPI/MMC 三个纯接线外设
linux·github·嵌入式
七歌杜金房3 天前
我终于又有了自己的 Linux 电脑
linux·debian·mac
tntxia4 天前
linux curl命令详解_curl详解
linux
扛枪的书生4 天前
Linux 网络管理器用法速查
linux
顺风尿一寸4 天前
Java Socket 内核之旅:从 SocketChannel.read() 到 tcp_recvmsg 与 epoll 的完整调用链路
linux
XIAOHEZIcode4 天前
Ubuntu 终端美化全栈指南:Bash 到 Kitty 踩坑实录
linux·ubuntu·命令行
唐青枫4 天前
别再只会用 cron:Linux systemd Timer 定时任务实战详解
linux