Copy file between two VMs from dom0 command

I’m trying to copy a file from a VM to another VM, from dom0 as part of an automated script.

So far I’ve tried:

qvm-run VM1 "qvm-copy-to-vm VM2 FILE which requires user interaction to select the destination vm.

qvm-copy-to-vm VM2 "$(qvm-run --pass-io VM1 "cat FILE")" which only displays the file in dom0 terminal without actually copying it.

Is anyone aware of some workaround that does not involve saving the file to dom0 and then transferring it to the second vm?

In /etc/qubes/policy.d/90-default.policy, lines 30 and 31

# File copy/move
qubes.Filecopy      *   @anyvm      @anyvm      ask

change to allow by creating policy with lower number. But, you should rethink possible security issues by allowing this.


Of course, I modified it to allow only the VMs needed for the script and then the policy will automatically be deleted once all necessary actions have been performed.

Thank you!

You are welcome @BEBF738VD . If you are satisfied, you might want to mark the post as solution so it could help other users too.

This thread belongs into ‘User Support’. I moved it there, which will also allow the OP to select a specific post as ‘Solution’.