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.
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).
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.
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.
On the Add Share dialog box, select Other from the Folder Path drop-down list.
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.
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.
The selected folder displays in the Folders List. Click OK to close the dialog box.
Now, make sure the guest machine is still selected in the VirtualBox Manager and click Start to boot it.
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.
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.
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.
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.
sudo adduser [username] 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.
To close the Terminal window, type “exit” (without the quotes) at the prompt and press Enter.
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.
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.
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.
0 comments:
Post a Comment