Orcle VM VirturalBox与Ubantu1404共享文件夹

Orcle VM VirturalBox与Ubantu1404共享文件夹_第1张图片

 

VirtualBox is a program that allows you to run multiple operating systems (guests) on one computer (the host computer). You may need to transfer files between the host and the guest. It’s easy to set up in Windows guests, but tricky in Ubuntu guests.

VirtualBox是一种程序,可让您在一台计算机(主机)上运行多个操作系统(来宾)。 您可能需要在主机和来宾之间传输文件。 在Windows guest虚拟机中设置起来很容易,而在Ubuntu guest虚拟机中设置起来比较麻烦。

We’ll show you how to set up an Ubuntu guest machine so you can access folders on the host machine from within the guest machine. You must enable shared folders to do this, which are available by installing VirtualBox guest additions software (see our article for instructions on how to do this).

我们将向您展示如何设置Ubuntu来宾计算机,以便您可以从来宾计算机中访问主机上的文件夹。 您必须启用共享文件夹才能执行此操作,这可以通过安装VirtualBox来宾添加软件来使用(有关如何执行此操作的说明,请参阅我们的文章 )。

Once you’ve installed the guest additions, enable shared folders by adding a folder from your host machine in the settings for the guest machine. To do this, first make sure the guest machine is powered off. Then, select the guest machine in the list on the left of the VirtualBox Manager and click Settings on the toolbar.

安装来宾添加后,通过在来宾计算机的设置中添加来自主机的文件夹来启用共享文件夹。 为此,请首先确保客户机已关闭电源。 然后,在VirtualBox Manager左侧的列表中选择客户机,然后单击工具栏上的“设置”。

On the Settings dialog box, click Shared Folders in the list of options on the left. On the Shared Folders screen, click the folder button with the plus sign to add a folder.

 

在“设置”对话框上,单击左侧选项列表中的“共享文件夹”。 在“共享文件夹”屏幕上,单击带有加号的文件夹按钮以添加文件夹。

Orcle VM VirturalBox与Ubantu1404共享文件夹_第2张图片

On the Add Share dialog box, select Other from the Folder Path drop-down list.

在“添加共享”对话框中,从“文件夹路径”下拉列表中选择“其他”。

Orcle VM VirturalBox与Ubantu1404共享文件夹_第3张图片

 

The Browse For Folder dialog box displays. Navigate to the folder you want to share between the host and the guest, select it, and click OK.

显示“浏览文件夹”对话框。 导航到您要在主机和来宾之间共享的文件夹,选择它,然后单击“确定”。

Orcle VM VirturalBox与Ubantu1404共享文件夹_第4张图片

The path to the selected folder is inserted in the Folder Path edit box. The name of the folder automatically becomes the Folder Name, but you can change this name if you want. If you don’t want to be able to change items in this folder in the guest machine, select the Read-only check box. To have the selected folder automatically mounted in the guest machine when you boot it, select the Auto-mount check box. Click OK once you’ve finished choosing your settings for the shared folder.

所选文件夹的路径将插入“文件夹路径”编辑框中。 文件夹的名称将自动变为“文件夹名称”,但是您可以根据需要更改此名称。 如果您不想更改来宾计算机中此文件夹中的项目,请选中“只读”复选框。 要在引导计算机时自动将所选文件夹安装在客户机中,请选中“自动安装”复选框。 完成选择共享文件夹的设置后,单击“确定”。

Orcle VM VirturalBox与Ubantu1404共享文件夹_第5张图片

The selected folder displays in the Folders List. Click OK to close the dialog box.

所选文件夹显示在“文件夹列表”中。 单击“确定”关闭对话框。

Orcle VM VirturalBox与Ubantu1404共享文件夹_第6张图片

 

Now, make sure the guest machine is still selected in the VirtualBox Manager and click Start to boot it.

现在,请确保在VirtualBox管理器中仍选择了客户机,然后单击“启动”以启动它。

Orcle VM VirturalBox与Ubantu1404共享文件夹_第7张图片

Once the guest machine is booted, open Nautilus (File Manager) by clicking the file cabinet on the Unity bar on the left side of the desktop.

客户机启动后,通过单击桌面左侧Unity栏上的文件柜,打开Nautilus(文件管理器)。

Orcle VM VirturalBox与Ubantu1404共享文件夹_第8张图片

In the Devices list on the left, click Computer and then double-click the Media folder on the right. You’ll see a folder named similarly to the folder you selected to share on your host machine with “sf_” added to the beginning of the name.

在左侧的“设备”列表中,单击“计算机”,然后双击右侧的“媒体”文件夹。 您将看到一个与您选择在主机上共享的文件夹类似的文件夹名称,名称的开头添加了“ sf_”。

Orcle VM VirturalBox与Ubantu1404共享文件夹_第9张图片

If you double-click on that folder, the following dialog box displays. This is because there is one more task to perform before you can access the shared folder.

如果双击该文件夹,将显示以下对话框。 这是因为在访问共享文件夹之前,还有另外一项任务要执行。

Orcle VM VirturalBox与Ubantu1404共享文件夹_第10张图片

In addition to users in Ubuntu, there are also groups. When VirtualBox installed the Ubuntu operating system, it added a group called “vboxsf”. Before you can access any shared folders, you must add yourself to the vboxsf group. To do this, press Ctrl + Alt + T to open a Terminal window. Type the following at the prompt, replacing “[username]” with your username, and press Enter.

除了Ubuntu中的用户外,还有组。 当VirtualBox安装Ubuntu操作系统时,它添加了一个名为“ vboxsf”的组。 在访问任何共享文件夹之前,必须将自己添加到vboxsf组。 为此,请按Ctrl + Alt + T打开“终端”窗口。 在提示符下键入以下内容,用您的用户名替换“ [username]”,然后按Enter。

sudo adduser [username] vboxsf

sudo adduser [用户名] vboxsf

Type your password when prompted and press Enter again. Messages display as you are being added to the group and “Done.” displays when the process has been successfully completed.

出现提示时输入密码,然后再次按Enter。 在您被添加到组和“完成”时,显示消息。 在过程成功完成时显示。

To close the Terminal window, type “exit” (without the quotes) at the prompt and press Enter.

要关闭“终端”窗口,请在提示符下键入“ exit”(不带引号),然后按Enter。

Orcle VM VirturalBox与Ubantu1404共享文件夹_第11张图片

To verify you are in the vboxsf group, you can type “id [username]” (without the quotes, and replacing “[username]” with your username) at the prompt and press Enter. All the groups of which the specified user is a member display.

要验证您是否在vboxsf组中,可以在提示符下键入“ id [username]”(不带引号,并用用户名替换“ [username]”),然后按Enter。 显示指定用户是其成员的所有组。

Orcle VM VirturalBox与Ubantu1404共享文件夹_第12张图片

Now, when you access the shared folder in the Media folder as described above, you should see any files in that exist in that folder on the host machine.

现在,当您如上所述访问“媒体”文件夹中的共享文件夹时,您应该看到主机上该文件夹中存在的所有文件。

Orcle VM VirturalBox与Ubantu1404共享文件夹_第13张图片

You can edit these files directly in this folder if you DID NOT select the “Read-only” option when selecting the folder in the Settings. You can also copy files into and out of this folder. If the folder was set to “Read-only”, you can only copy files from this folder and cannot copy files into it.

如果在“设置”中选择文件夹时未选择“只读”选项,则可以直接在此文件夹中编辑这些文件。 您也可以将文件复制到该文件夹​​中以及从该文件夹中复制文件。 如果文件夹设置为“只读”,则只能从该文件夹复制文件,而不能将文件复制到其中。

你可能感兴趣的:(ubuntu,linux,运维)