How to copy data between Virtual machines

Solution 1:

The answer should be complex, I hope not too much complicate, but more you read down more it is complex:

  1. You can copy few (or more) lines with copy & paste mechanism.

    For this you need to share clipboard between host OS and guest OS, installing Guest Addition on both the virtual machines (probably setting bidirectional and restarting them).
    You copy from guest OS in the clipboard that is shared with the host OS.
    Then you paste from the host OS to the second guest OS.

  2. You can enable drag and drop too with the same method (Click on the machine, settings, general, advanced, drag and drop: set to bidirectional )

  3. You can have common Shared Folders on both virtual machines and use one of the directory shared as buffer to copy.

    Installing Guest Additions you have the possibility to set Shared Folders too. As you put a file in a shared folder from host OS or from guest OS, is immediately visible to the other. (Keep in mind that can arise some problems for date/time of the files when there are different clock settings on the different virtual machines).
    If you use the same folder shared on more machines you can exchange files directly copying them in this folder.

  4. You can use usual method to copy files between 2 different computer with client-server application. (e.g. scp with sshd active for linux, winscp... you can get some info about SSH servers e.g. here)

    You need an active server (sshd) on the receiving machine and a client on the sending machine. Of course you need to have the authorization setted (via password or, better, via an automatic authentication method).

    Note: many Linux/Ubuntu distribution install sshd by default: you can see if it is running with pgrep sshd from a shell. You can install with sudo apt-get install openssh-server.

  5. You can mount part of the file system of a virtual machine via NFS or SSHFS on the other, or you can share file and directory with Samba.
    You may find interesting the article Sharing files between guest and host without VirtualBox shared folders with detailed step by step instructions.

You should remember that you are dialling with a little network of machines with different operative systems, and in particular:

  • Each virtual machine has its own operative system running on and acts as a physical machine.
  • Each virtual machine is an instance of a program owned by an user in the hosting operative system and should undergo the restrictions of the user in the hosting OS.

    E.g Let we say that Hastur and Meow are users of the hosting machine, but they did not allow each other to see their directories (no read/write/execute authorization). When each of them run a virtual machine, for the hosting OS those virtual machine are two normal programs owned by Hastur and Meow and cannot see the private directory of the other user. This is a restriction due to the hosting OS. It's easy to overcame it: it's enough to give authorization to read/write/execute to a directory or to chose a different directory in which both users can read/write/execute.

  • Windows likes mouse and Linux fingers. :-)
    I mean I suggest you to enable Drag & drop to be cosy with the Windows machines and the Shared folders or to be cosy with Linux.
    When you will need to be fast with Linux you will feel the need of ssh-keygen and to Generate once SSH Keys to copy files on/from a remote machine without writing password anymore. In this way it functions bash auto-completion remotely too!

Solution 2:

You could use scp or WinSCP for this.
An alternative might be to set up shared folders between the VirtualBox and the host machine.

I don't have VirtualBox, but to copy from my host machine to it's KVM guests I use:

scp <filename> guest:

The ':' at the end is required to let scp know it's copying to "another" machine and not to the host machine. The command for a VirtualBox VM is probably the same.

I found a more detailed explanation here, but since I don't use VirtualBox myself I cannot verify it.

Solution 3:

Check the 'Advanced' tab of the 'General' settings of your VM in Virtual Box Manager. You can there activate the shared clipboard and the drag'n'drop.

More of it, you can set up shares between host and VM in the VM settings.

And finally, you can start a virtual network linking all VMs and optionally the host. Go to the global preferences, line Network, tab 'host-only network' and click the button add. Next,in the VM settings, add a host-only network adapter and select the private network you created.

HTH