配置Ubuntu虚拟机共享文件夹

Lani ·
更新时间:2024-09-20
· 734 次阅读

文章目录环境安装 open-vm-tools配置 open-vm-tools设置 VMware 共享文件夹 环境

系统:Ubuntu 18.04
虚拟机软件:VMware Workstation 15

安装 open-vm-tools

在终端中使用 apt-get 安装 open-vm-tools

sudo apt-get install open-vm-tools sudo apt-get install open-vm-tools-desktop

重启后,虚拟机已支持在和 Windows 之间复制黏贴以及拖拉文件到虚拟机桌面。

配置 open-vm-tools

进入 /etc/systemd/system 目录并创建文件 mnt.hgfs.service

cd /etc/systemd/system sudo vim mnt.hgfs.service

写入以下内容

[Unit] Description=Load VMware shared folders Requires=vmware-vmblock-fuse.service After=vmware-vmblock-fuse.service ConditionPathExists=.host:/ ConditionVirtualization=vmware [Service] Type=oneshot RemainAfterExit=yes ExecStart= ExecStart=/usr/bin/vmhgfs-fuse -o allow_other -o auto_unmount .host:/ /mnt/hgfs [Install] WantedBy=multi-user.target

保存后用 systemctl 命令使能这个 service

sudo systemctl enable mnt.hgfs.service 设置 VMware 共享文件夹

打开 VMware 的虚拟机设置界面,在共享文件夹中添加要共享的 Windows 文件夹路径,名称任意一个都行。
在这里插入图片描述
然后在 Ubuntu 的路径 /mnt/hgfs 下会出现刚才设置的共享文件夹,如果没有该路径就新建一个

sudo mkdir /mnt/hgfs
作者:灿烂星汉



ubuntu 共享文件 共享文件夹

需要 登录 后方可回复, 如果你还没有账号请 注册新账号