This is not the best answer to your question because it ignores the problem and accomplishes transfers another way. Nevertheless, I'm posting this answer anyway because I've been in your shoes, and I typically resort to using the virtual network between VM and host to transfer files. Instead of wasting time trying to get vbox features to work, I just use netcat
to perform an insecure file transfer. The fact that it's insecure would only matter if your VM is visible to your host's local network. By default, it uses NAT, so that fact that it's an insecure transfer is likely inconsequential.
Assumptions:
- Default network settings (NAT, no virtual network customization)
Guest VM can see host computer at 10.0.2.2 (typical default for VirtualBox)
Getting the hosts virtual network IP: (Added 2017-05-06)
You could use your host's IP for whatever non-virtual network it's connected to, but I would advise against that for security reasons. Use the IP from the virtual network. It's safer.
In the virtual machine guest OS, open a terminal and run the following command:
route -n | grep -P "^0.0.0.0" | tr -s ' ' | cut -f2 -d ' '
The IP address that is returned by this command is the IP address you'll substitute below in the nc
commands. Mine is 10.0.2.2
Host -> Guest file transfer:
- On your host, run
cat /your/file/to/transfer | nc -l 21435
. Here, 21435
is the port to use. You can subsitute any unused port.
- On the guest machine run
nc 10.0.2.2 21435 > /your/file/to/save
.
Guest -> Host file transfer:
- On your host, run
nc -l 21435 > /your/file/to/save
.
- On the guest machine run
cat /your/file/to/transfer | nc 10.0.2.2 21435
.
Regardless of the direction of the transfer, make sure you run the commands above in the order listed (for the direction in question). This is important because the first command starts a listening service to which the second command connects. After running the first command, the terminal will appear to become unresponsive. The program is running and listening on that machine. Once the second command is run on the other machine and the transfer completes, the terminals on both machines will "become responsive" again (ie. nc
will exit).
To transfer multiple files, it may be easier to compress them all into a single archive file first.
I would not advise doing sensitive file transfers like this over a network that other parties might be able to eavesdrop on unless you were to take other means to encrypt the data.