4 ms·
I often have the problem that I am in a VirtualBox VM and want to get a file to the host. I never found a solution other then to upload it somewhere on the int
by TicklishTiger 8y ago
I often have the problem that I am in a VirtualBox VM and want to get a file to the host.
I never found a solution other then to upload it somewhere on the internet and then download it on the host.
Yes, I know you can probably configure something before starting the VM to make VM and host share files.
But I usually want to have them completely sepereated. Only when the need arises to transfer a file, I would like to do so ad hoc.
Is there a solution?
- Cei5ouko 8y agoYou can add shared folders at the host side at runtime and then mount them in the guest. Or you can expose network filesystems (CIFS, NFS) on either side and mount on the other.
- TicklishTiger 8y agoAs I understand it, host and guest can not see each other on the lan. So I think neither is possible.
- detaro 8y agoThat depends on how you configure the networking for the VM.
- TicklishTiger 8y agoYes, I stated that in my original question already.
- detaro 8y agoNot clearly IMHO. If the VM being able talk to the host is not acceptable to you, even if you only activate that during runtime when you need it, then scp obviously isn't a solution.
- Unklejoe 8y agoChange the networking config from NAT to bridged. The VM will now appear as a truly independent device on your LAN, as if it were plugged into a switch.
- TicklishTiger 8y agoBut then it can talk to the lan. I don't want that. The whole reason I have some apps running in a VM is to be shielded from them.
- Spivak 8y agoThen you need to add a port forward to get through the NAT. However, NAT isn't security and you might be better off using a bridge and a firewall to shield your VM.
- Cei5ouko 8y agovirtualbox adds a network interface to connect host and VM to each other, you can reach them via private IPs. the exact IPs used depend on the type of network mapping used (NAT, host-only, bridged)
- antocv 8y agoIf the file is saved on a kind of disk, and not only in-memory on your VM, it is already on your host in the disk image of the VM, you just extract it. With qemu I usually loopback mount in readonly mode the disk and access whatever I want from the VM guest that way.
- TicklishTiger 8y agoVirtualBox creates .vdi files. Looks like there is no easy way to mount them.
- runyor 8y agoIf you go this way, why not simply use SCP on the host?
- TicklishTiger 8y agoWhere would I scp to?
- edoceo 8y agoSCP from Guest to Host
- TicklishTiger 8y agoWhat is the ip of the host? I am pretty sure the guest is seeing a lan that only contains itself.
- seiferteric 8y agoIt sounds like you are talking about NAT mode on virtualbox. In this case you can set up port forwarding in the network settings. Also, you can actually reach the host from the guest. In my case my guest has an IP of 10.0.2.15 by default, and I can reach the host on 10.0.2.2
- runyor 8y agoYou open a shell on the host, and then `scp guest:path/to/file target/path/to/file`.
- TicklishTiger 8y agoWhat is 'guest' here? As far as I know, the VM does not have an IP on the lan.
- runyor 8y agoI mean, you need to be able to use your VM Manager tool to find out what is the IP/hostname of your guest.