Thursday, April 4, 2013

Sharing folders between Ubuntu 12.04.1 Guest and Windows 7 Host when using VirtualBox

If you are running Ubuntu 12.04.1 i386 on your Windows 7 32-bit using VirtualBox, and found yourself wanting to share files between the two, here is how to get that done using the GUI:
  1. Make sure to install the guest addition on your Guest OS (Ubuntu 12.04.1)
    This will allow you to share clipboard (Copy/Paste) between Ubuntu and Windows and allow you to share folders between the two among other things.
    The following screenshots provide hints at how to get that done.
    Select "Install Guest Addition.."
    This will mount the VirtualBox Guest Additions CD image ISO file on Ubuntu
    Autorun dialog will appear in Ubuntu, select Run

  2. Share folders
    Share some folders between Windows and Ubuntu.
    The following screenshots provide hints at how to get that done.
    You will need to reboot the virtual machine every time you want to share a new folder.
    Select "Shared Folders" from the Devices menu of VirtualBox
    Click the Add icon (Blue folder with green sign)
    Make sure to select the "Auto-mount" and "Make Permanent" Options

  3. Install "Users and Groups"
    If you cd to the shared folders (eg /media/sf_GitHub in my case), you will note that you aren't allowed to do so. This is because the user account that you have logged in with does not yet have the permission to access those folders. What we need is a GUI program which will help you to add users to various groups and grant them permission. To install this program, open a terminal windows in Ubuntu (Ctrl+Alt+T) and execute the command:
    sudo apt-get install gnome-system-tools

    For this installation to execute successfully, you will need internet access on your PC. Make sure that the Ubuntu VirtualMachine can access the internet using the Guest OS's connection (enabled by default when you install VirtualBox)

  4. Add user to vboxsf group
    Open a terminal (Ctrl+Alt+T) and execute the command:
    users-admin

    A GUI panel will open up, follow the instructions as below:
    Start "Users and Groups" by running the command users-admin
    Then select your username and click on "Manage Groups"

    Select "vboxsf" from the list of group and click properties

    Tick the checkbox next to your username and click OK.
    Restart your Ubuntu virtual machine.
    You should be able to cd to your shared folder in /media

References:

0 comments:

Post a Comment