1

Imagine the following setup:

  • Two laptops: Let's call them [laptop A] and [laptop B].
  • Each laptop has the same operating system installed (Debian 9 Stretch)
  • Each laptop has openssh-server installed
  • Each laptop has firewalld and firewall-config installed
  • Each laptop has qemu-kvm installed
  • Each laptop is running a VM via qemu-kvm
  • The file exchange between VM and its host (= laptop host system) is provided by SFTP-exchange

Saying this, the file exchange between VMs and their belonging hosts is working completely fine by accessing hosts /home-directory via sftp://user@192.168.122.1 from the guest.

Example: It is possible to share files between [laptop A] and [virtual machine A] or between [laptop B] and [virtual machine B] using SFTP-exchange via command above.

But - the more interesting question now is:

How can I share files between...

  1. [laptop A] and [laptop B]?
  2. [laptop A] and [virtual machine B]?
  3. [laptop B] and [virtual machine A]?
1

This problem is not really SSH-related. In order to do this the VMs must be able to reach the network outside the laptops (i.e. their interface has to be bridged or their traffic has to be routed / NATed) and their must be reachable from there is the connection shall be initiated from the laptop.

If you bridge the interface or route the traffic and give the VM a visible IP address then you must allow forwarding the traffic in the laptop firewall. In case of NAT you have to define a port and create a DNAT rule in nat/PREROUTING for it. But I am not sure if this is possible at all because I do not use this configuration.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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