'How to copy a file from VirtualBox to the host OS?

I am using VirtualBox and my guest OS is Ubuntu. I have already install the Guest additions and created a share folder. My host OS is Windows 7.

I have a file inside the Ubuntu OS at Documents/myfolder and I want to copy this file to any partition in Win 7. Can any one give me the steps?



Solution 1:[1]

With the VM stopped, under settings shared folders create something like this. Folder Path is your host path and Mount point is in the VM. enter image description here

Then start the VM, open a terminal (this is an Ubuntu VM) and run sudo mount -t vboxsf vbox_share /mnt with vbox_share matching the Folder Name field in the picture above.

Solution 2:[2]

Easiest way:

  1. Open netcat receiver on your host:

nc -l -p 1234 > file.zip

  1. Send your file from guest

nc 10.0.2.2 1234 < file.zip

Solution 3:[3]

Check your /mnt directory on Ubuntu. There you should see the shared folder already mounted. In advance, verify that the shared folder is still active, in the VMs preferences.

If the shared folder is not visible under /mnt, then you have to mount it manually, as described here.

Solution 4:[4]

Just enable the "Drag and Drop" either one way (guest to host or host to guest) or both ways. Then just do drag and drop from host to guest or vice versa.

enter image description here

Solution 5:[5]

You can use WinSCP to connect from your Windows machine. No need to set up anything except SSH on your Linux machine.

Solution 6:[6]

If you are running a guest that doesn't support the guest additions, another option is to use A USB drive connected to the host, and share it to the guest. In the Virtualbox guest window, Devices->USB Devices, select the usb drive. This does not require guest additions. This will usually make the device inaccisable in the host, so basically you attach the USB to the guest, add the files to it, then detach. In my case I was running ubuntu server and a message appeared on the prompt showing that it was added as /dev/sdb, but in my case sdb wasn't mountable but sdb1 was:

cd /mnt
mkdir somename
mount /dev/sdb1 /mnt/somename

This is from memory but hopefully this will get other noobs like me on the right track if you have a guest that you can't get the guest additions setup on.

Note that doing lots a large amount of writing to a flash drive does wear it out.

Solution 7:[7]

Another easiest way to share files and folders from guest to host is:

  1. Download a Puppy Linux Live CD (iso file) from its website: (https://puppylinux-woof-ce.github.io/index.html#download)

  2. Attach the iso file to the guest os in its settings -> storage

  3. Start the guest VM. This will start the puppy linux os.

  4. Check if the ftpd server is available on its network menu. if not, then Google Search for "puppy linux ftp server" on its internet browser and download the ftpd.pet program

  5. Single click on the .pet file downloaded in step 4 to install it and then Run the ftpd server option from the puppy linux network menu option and follow its instructions ( just need to set the root user password through the terminal, by issuing : passwd root ( and press the enter key )

  6. Also, note down its IP address by hovering on the network tray icon

  7. Use FileZilla or Winscp on the host to connect to the guest and transfer files now

That's it.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 gary69
Solution 2
Solution 3
Solution 4 VHS
Solution 5 sajagi
Solution 6 AaronLS
Solution 7 Nathan SR