一、进入/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