2012. Sharing Files between Host and Guest in VirtualBoxVirtualBox, Ubuntu, and macOS
Introduce how to achieve bidirectional file sharing between macOS host and Ubuntu guest.
1. Installing VirtualBox Guest Additions
1) Get VBoxGuestAdditions.iso
In macOS, Finder->Application->VirtualBox->Show Package Content
Find VBoxGuestAdditions.iso in /Contents/macOS/.
Copy it to another folder, eg. ~/Downloads/
2) Insert the Image to Ubuntu VM
Ubuntu VM->Devices->Optical Drives->Choose disk image…, locate to ~/Downloads/VBoxGuestAdditions.iso.
3) In Ubuntu, select VBoxGuestAdditions.iso, and click ‘Run Software’ to install.
After Guest Additions are installed, a new user group ‘vboxsf’ has been created.
2. Creating Shared Folder on macOS
In macOS, create a new folder /UbuntuSF/, which is used to share files with Ubuntu.
3. Adding Shared Folder to VM’s SharedFolders
In VirtualBox, select Ubuntu VM->Settings->SharedFolders, click ‘Add Folder’ at the right side. Set path to /UbuntuSF
, check ‘Auto-mount’ and ‘Make Permanent’.
The shared folder is created for VM now.
4. Adding User to Group ‘vboxsf’ in Ubuntu
In Ubuntu VM, run the following command in terminal.
$ sudo adduser johnny vboxsf
Then, reboot Ubuntu.
5. Checking the Shared Folder in Ubuntu
Go to directory /media/, there should be a new shared folder sf_UbuntuSF
.
Create a new file here.
You will see it in /UbuntuSF on macOS.