如何与Ubuntu虚拟机(来宾)共享文件夹
VMware Workstation provides a great ability to create shared folders so that your virtual machine can easily access data on your host pc. This saves a lot of time, especially when you are installing software that would otherwise take a long time to download.
VMware Workstation具有创建共享文件夹的强大功能,因此您的虚拟机可以轻松访问主机PC上的数据。 这样可以节省大量时间,尤其是当您安装软件时,如果下载该软件将花费很长时间。
For this to work, you will need to make sure that you have the vmware tools installed and running.
You can check to see if the vmware shared folders module is running by running this command:
您可以通过运行以下命令来检查vmware共享文件夹模块是否正在运行:
lsmod | grep vmhgfs
lsmod | grep vmhgfs
If you get nothing then the mdoule is not loaded. You will need to load it with this command:
如果您什么也没收到,则不会加载mdoule。 您将需要使用以下命令加载它:
modprobe vmhgfs
modprobe vmhgfs
If that gives you another error, then you don’t have the vmware tools installed, and you will want to make sure to install them before proceeding.
如果那又给您带来另一个错误,则说明您尚未安装vmware工具,因此您需要确保在继续之前安装它们。
In VMware Workstation, go to the VM \ Settings window and then click on the Options tab. From here you can modify the shared folders.
在VMware Workstation中,转到“ VM \设置”窗口,然后单击“选项”选项卡。 在这里您可以修改共享文件夹。
Click the Add button, and you will be presented with a wizard. Click next, and you should see this screen:
单击添加按钮,将显示一个向导。 单击下一步,您将看到以下屏幕:
The name field will become part of the mounted path in Ubuntu, so name it something short and to the point. For instance, this shared folder will be mounted on /mnt/hgfs/mydrive/
名称字段将成为Ubuntu中已挂载路径的一部分,因此应使用简短的名称。 例如,此共享文件夹将安装在/ mnt / hgfs / mydrive /
Select the host folder that you want to share and then click the Next button
选择要共享的主机文件夹,然后单击“下一步”按钮
If you are worried about the guest operating system messing with your files, you can select the read-only checkbox. I personally did so simply because I was worried about accessing in-use files.
如果您担心客户机操作系统将文件弄乱了,则可以选择只读复选框。 我之所以这样做,仅仅是因为我担心访问使用中的文件。
You shouldn’t even have to restart your virtual machine. The folders should immediately show up under /mnt/hgfs
您甚至不必重启虚拟机。 该文件夹应立即显示在/ mnt / hgfs下
That’s all there is to it. Remember, if you have problems it’s probably because your vmware tools are not installed.
这里的所有都是它的。 请记住,如果遇到问题,可能是因为未安装vmware工具。
Tested on: Ubuntu Dapper, Ubuntu Edgy Eft
经过测试:Ubuntu Dapper,Ubuntu Edgy Eft
Update: If you have problems you might also want to check your firewall settings, which could be disabling communications between the virtual machine and your host computer. Thanks to burkhard in the comments for noticing this.
更新:如果遇到问题,您可能还需要检查防火墙设置,这可能会禁用虚拟机与主机之间的通信。 感谢burkhard在评论中注意到这一点。
翻译自: https://www.howtogeek.com/howto/ubuntu/how-to-share-folders-with-your-ubuntu-virtual-machine-guest/