解决vmware上Ubuntu共享文件夹(2022年7月)
解决vmware上Ubuntu共享文件夹(2022年7月) - 大佬不小 - 博客园
解决vmware上ubuntu无法共享文件夹问题(ubuntu22.04)
第一步:设置共享文件夹
第二步:安装open-vm-tools
1 sudo apt install open-vm-tools*
第三步:挂载文件夹
-
先查看设置的文件夹有没有起效
1 vmware-hgfsclient
如果出现有挂载对应的文件夹就起效
-
创建目录并挂载
1 sudo mkdir /mnt/hgfs
-
手动挂载/自动挂载
手动挂载方法
但是每次重启都得挂载一遍,比较麻烦
1 sudo vmhgfs-fuse .host:/VMshare /mnt/hgfs
自动挂载方法
1 sudo cp /etc/fstab /etc/fstab.bak 2 sudo vim /etc/fstab
在最后一行插入这样一句
1 .host:/VMshare /mnt/hgfs fuse.vmhgfs-fuse allow_other,defaults 0 0
VMshare是自己设置的文件夹名称,/mnt/hgfs挂载点,fuse.vmhgfs-fuse挂载方法
最后保存退出(先别走!)
由于配置自动挂载文件容易配置错误导致系统进入emergency mode,最好要备份好fstab文件,并且做好虚拟机快照,或者搜索在emergency mode的恢复方法
然后cd到/mnt/hgfs里就能看到共享的文件了,有可能需要管理员权限
如果你在此之前安装过官方的vmtool或者旧版本的open-vm-tools最好先卸载干净
1 sudo vmware-uninstall-tools.pl 2 sudo apt-get remove open-vm-tools 3 sudo apt-get remove --auto-remove open-vm-tools 4 sudo apt-get purge open-vm-tools 5 sudo apt-get purge --auto-remove open-vm-tools
Ubuntu: Cannot access ‘/hgfs‘: No such file or directory
Ubuntu: Cannot access ‘/hgfs‘: No such file or directory_Logan龙的博客-CSDN博客
此时,你无论怎么尝试,会出现两种错误,错误1:显示你没权限;错误2:进入hgfs之后看不到设定的共享文件夹。(我用的: D:/arm)
解决方案:
取消挂载的hgfs;
sudo umount /mnt/hgfs
1
输入如下命令:用自己的用户名挂载。 id 和 umask 如图。
/usr/bin/vmhgfs-fuse .host:/ /mnt/hgfs/ -o allow_other -o uid=1000 -o gid=1000 -o umask=0002
1
2
可能会报错如下:
fusermount: option allow_other only allowed if 'user_allow_other' is set in /etc/fuse.confhost:/ /mnt/hgfs/ -o allow
1
也比较简单,打开conf 文件,将user_allow_other前面的 # 去掉,然后保存;
sudo vi /etc/fuse.conf
1
在重复输入步骤2的命令:…,然后就挂载搞定了,我们 ls 一下,发现文件夹权限搞定,不再是root。
6. 进入 hgfs目录下后,发现我们虚拟机设置的arm文件夹也出来了,结束!
————————————————
版权声明:本文为CSDN博主「Logan龙」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_40514373/article/details/125832340
参考引用:
https://www.cnblogs.com/nanopeng/p/7017351.html
https://blog.csdn.net/weixin_43445661/article/details/109497763
https://blog.csdn.net/weixin_44565095/article/details/95937794