Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a linux machine, and windows is installed as a VM. While copying a data from linux desktop into windows, data is not receiving (I mean copy and paste).

Is there any way to copy data between two virtual machines?

share|improve this question
up vote 5 down vote accepted

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!

share|improve this answer is working... :) and the answer is looking bit complicated. – meow Aug 8 '14 at 9:43
@meow ...a bit or a bit too much? :-) When you deal with different operative systems you always have to deal with the two sides of the same problem :(. The 1st, 2nd and 3rd, points are fast and almost simple. The 4th starts to be more complex, but useful in a Linux way (especially the second part). The 5-th point is more for office or specific and/or professional tasks (e.g. I want to run 2 WWW servers on two different virtual machine but I want to share analytic logs maybe on a third machine... so if one machine crashes or is under attack the second will be not...) – Hastur Aug 8 '14 at 10:35
@ Hastur : while reading I got more confused, and i read again and again.. :) now it is clear.. also an interesting and very useful answer. – meow Aug 8 '14 at 10:40
@meow Thanks but please help me to write in a more understandable way asking where it is not clear enough. – Hastur Aug 8 '14 at 21:27

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.

share|improve this answer
Actually, I was asked about copying data, but copying through file, I haven't checked that. Like, 5 lines of data...something like that... – meow Aug 8 '14 at 8:42
If you want drag-n-drop, it looks like this is not supported for security reasons:… . – S.L. Barth Aug 8 '14 at 8:51

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.


share|improve this answer

protected by Community Aug 8 '14 at 7:44

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.