VMware下ubuntu虚拟机和windows创建共享文件夹

一、在虚拟机设置要共享的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:~$
  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值