CentOS找不到VMware共享的文件夹

本文详细介绍了在Ubuntu系统下如何进入/mnt目录,检查并创建hgfs文件夹,使用sudo命令挂载vmhgfs,并解决非root用户无法访问的问题。通过添加'allow_other'选项赋予所有用户读写权限。最后,提供了两种方法将挂载设置为开机启动,确保系统启动时自动挂载。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、进入/mnt目录。

cd /mnt

二、查看有没有hgfs文件夹,没有进行创建。

ms@ubuntu:~$ cd /mnt
ms@ubuntu:/mnt$ ls
ms@ubuntu:/mnt$ mkdir hgfs
mkdir: cannot create directory ‘hgfs’: Permission denied
ms@ubuntu:/mnt$ sudo mkdir hgfs

三、执行sudo vmhgfs-fuse /mnt/hgfs进行挂载,虽挂载成功,但必须是root用户才能正常使用,也无法修改权限。

ms@ubuntu:/mnt$ sudo vmhgfs-fuse /mnt/hgfs
ms@ubuntu:/mnt$ ls hgfs
ls: cannot access 'hgfs': Permission denied
ms@ubuntu:/mnt$ sudo ls
hgfs
ms@ubuntu:/mnt$ sudo ls hgfs
D  E  F
ms@ubuntu:/mnt$ sudo ls -al
total 13
drwxr-xr-x  3 root root 4096 Nov  3 14:10 .
drwxr-xr-x 21 root root 4096 Nov  3 11:52 ..
dr-xr-xr-x  1 root root 4192 Nov  3 14:19 hgfs
ms@ubuntu:/mnt$ sudo chmod 777 hgfs
chmod: changing permissions of 'hgfs': No such file or directory

四、挂载并增加读写权限。

命令为:

sudo vmhgfs-fuse .host:/ /mnt/hgfs -o subtype=vmhgfs-fuse,allow_other
或
sudo vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other

执行如下:

ms@ubuntu:~$ sudo vmhgfs-fuse .host:/ /mnt/hgfs -o subtype=vmhgfs-fuse,allow_other
ms@ubuntu:~$ cd /mnt/
ms@ubuntu:/mnt$ ll
total 13
drwxr-xr-x  3 root root 4096 Nov  3 14:10 ./
drwxr-xr-x 21 root root 4096 Nov  3 11:52 ../
dr-xr-xr-x  1 root root 4192 Nov  3 14:33 hgfs/
ms@ubuntu:/mnt$ ll hgfs/
total 37
dr-xr-xr-x 1 root root  4192 Nov  3 14:33 ./
drwxr-xr-x 3 root root  4096 Nov  3 14:10 ../
drwxrwxrwx 1 root root  8192 Nov  3 09:21 D/
drwxrwxrwx 1 root root 12288 Nov  3 09:21 E/
drwxrwxrwx 1 root root  8192 Nov  3 09:21 F/
ms@ubuntu:/mnt$

五、可加入开机启动项,开机自动挂载。

1、方法一:以脚本形式加入启动项。

2、方法二:在/etc/fstab末尾添加一行代码如下。

.host:/        /mnt/hgfs  fuse.vmhgfs-fuse    allow_other,defaults 0       0

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

寞水

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值