Ubuntu(Linux)虚拟机与主机共享文件夹hgfs文件普通用户不能访问问题

参考文章:
https://blog.csdn.net/weixin_42224577/article/details/108107554
在虚拟机中设置好添加共享文件后,普通用户并不能访问mnt文件里的hgfs文件

切换成root后可以看到共享的文件
改权限不行,改用户拥有者也不行

haima@haima-PC:/mnt$ ll
ls: 无法访问'hgfs': 权限不够
总用量 0
d????????? ? ? ? ?             ? hgfs
haima@haima-PC:/mnt$ su
密码:
root@haima-PC:/mnt# ll
总用量 5
dr-xr-xr-x 1 root root 4192 8月   6 18:08 hgfs
root@haima-PC:/mnt# chmod -R 777 hgfs/
chmod: 更改'hgfs/' 的权限: 没有那个文件或目录
root@haima-PC:/mnt# chown haima haima hgfs/
chown: 无法访问'haima': 没有那个文件或目录
chown: 正在更改'hgfs/' 的所有者: 没有那个文件或目录

解决方法:

haima@haima-PC:~/Desktop$ id
uid=1000(haima) gid=1000(haima) 组=1000(haima),7(lp),27(sudo),100(users),109(netdev),113(lpadmin),119(scanner),123(sambashare)
haima@haima-PC:~/Desktop$ sudo /usr/bin/vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other -o uid=1000 -oumask=022 -o nonempty
[sudo] haima 的密码:
haima@haima-PC:~/Desktop$ cd /mnt/
haima@haima-PC:/mnt$ ll
总用量 5
drwxr-xr-x 1 haima root 4192 8月   6 18:17 hgfs
haima@haima-PC:/mnt$ cd hgfs/
haima@haima-PC:/mnt/hgfs$ ll
总用量 4
drwxr-xr-x 1 haima root 4096 3月  27 12:47 work

[Haima的博客] http://www.cnblogs.com/haima/
原文地址:https://www.cnblogs.com/haima/p/15109922.html