花费很长时间,解决共享文件夹的问题
前言
为了熟悉Linux系统,以及学习Linux内核,在Win10系统装了VMware player16,跑Ubuntu 20.04(官网下载)。
要保证下载VMware tool,解压并安装好。
一、共享文件夹设置
二、问题:找不到vmshare文件夹
输入vmware-hgfsclient 能看到设置的共享文件夹
xxxxxxx@ubuntu:/$ vmware-hgfsclient
vmshare
然而,ls找不到该共享文件夹:
解决方法:
1.从普通用户切换到root用户
xxxxxx@ubuntu:/$ su
Password:
root@ubuntu:/#
2.出现文件挂载的问题?
root@ubuntu:/# mount -t vmhgfs .host:/vmshare /mnt/hgfs
Error: cannot mount filesystem: No such device
安装open-vm-dkms出现问题:
root@ubuntu:/# sudo apt-get install open-vm-dkms
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package open-vm-dkms
安装open-vm-tools成功,但依然出现文件挂载的问题:
root@ubuntu:/# apt-get install open-vm-tools
Reading package lists... Done
Building dependency tree
Reading state information... Done
open-vm-tools is already the newest version (2:11.3.0-2ubuntu0~ubuntu20.04.2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@ubuntu:/# mount -t vmhgfs .host:/vmshare /mnt/hgfs
Error: cannot mount filesystem: No such device
root@ubuntu:/# sudo mount -t vmhgfs .host:/vmshare /mnt/hgfs
Error: cannot mount filesystem: No such device
更换一种挂载命令?
root@ubuntu:/mnt/hgfs# sudo vmhgfs-fuse .host:/ /mnt/hgfs
fuse: mountpoint is not empty
fuse: if you are sure this is safe, use the 'nonempty' mount option
root@ubuntu:/mnt/hgfs# sudo vmhgfs-fuse .host:/vmshare /mnt/hgfs
fuse: mountpoint is not empty
fuse: if you are sure this is safe, use the 'nonempty' mount option
解决:
root@ubuntu:/# sudo vmhgfs-fuse .host:/ /mnt/hgfs -o nonempty -o allow_other
root@ubuntu:/# ls /mnt/hgfs/
vmshare
3.此时切换到普通用户,共享文件夹也显示也正常了
root@ubuntu:/# su chuanye
xxxxxx@ubuntu:/$ ls /mnt/hgfs/
vmshare