一、在虚拟机设置要共享的windows文件夹
- 启动虚拟机
- 选择菜单栏中的虚拟机
- 选择设置中的选项
- 设置共享文件夹
二、在ubuntu中进行设置
1、查看共享文件夹是否设置成功:
vmware-hgfsclient
若成功则会显示在windows下共享文件夹的名称
2、若失败
在一中设置之后,在命令行执行以下代码
//如果之前没有命令包则先执行sudo apt-get install open-vm-tools
//更改账户的权限,只有在输入账户的密码之后才能够查看到.即执行
sudo vmhgfs-fuse .host:/ /mnt/hgfs -o nonempty -o allow_other
设置完成之后在**/mnt/hgfs**查看共享文件夹
sky@ubuntu:~$ sudo apt-get install open-vm-tools
[sudo] password for sky:
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).
The following packages were automatically installed and are no longer required:
libfwupdplugin1 linux-headers-5.13.0-39-generic linux-hwe-5.13-headers-5.13.0-39 linux-image-5.13.0-39-generic linux-modules-5.13.0-39-generic
linux-modules-extra-5.13.0-39-generic
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 29 not upgraded.
sky@ubuntu:~$ sudo vmhgfs-fuse .host:/ /mnt/hgfs -o nonempty -o allow_other
sky@ubuntu:~$ cd /mnt/hgfs/ && ls
vmshare
sky@ubuntu:/mnt/hgfs$
之后就可以在windows和ubuntu之间共享文件
sky@ubuntu:~$ cp workspace/test/a.c /mnt/hgfs/vmshare/
sky@ubuntu:~$ ls /mnt/hgfs/vmshare/
a.c c_glib.rar
sky@ubuntu:~$