Copying Files between AppVMs using Dom0

188 views
Skip to first unread message

cr33d...@gmail.com

unread,
May 7, 2018, 9:00:21 AM5/7/18
to qubes-users
Hey All,

i know about the method to copy a file between Dom0 and DomU's and also about the way how to directly copy a file from AppVM to AppVM with qvm-copy-to-vm.

My Question is:
Is there a way to execute a command on Dom0 that is like: copy [source-vm][path] [dest-vm][path] ?

Hopefully it is.

Thanks,
Jonny

Ivan Mitev

unread,
May 7, 2018, 9:15:30 AM5/7/18
to qubes...@googlegroups.com
Hi,
you could use `qvm-run sourcevm "qvm-copy /path/to/file` but you'd get a
popup to select the destination VM and you can't set the destination
path. Probably not what you want.

Alternatively, pass I/O from one VM to the other with a pipe. For a file:

qvm-run -p sourcevm "cat /path/to/file" | qvm-run -p destvm "cat >
/path/to/file"

for a dir you'll likely have to tar to stdout and untar in the destvm
from stdin.
Message has been deleted

cr33d...@gmail.com

unread,
May 7, 2018, 9:26:28 AM5/7/18
to qubes-users
Hi Ivan,

sounds good - i will try both and look which suits best.

If there are any other approaches out there, feel free to let me know.

Thanks,
Jonny

cr33d...@gmail.com

unread,
May 7, 2018, 10:35:55 AM5/7/18
to qubes-users
Hi,

>Am Montag, 7. Mai 2018 15:15:30 UTC+2 schrieb Ivan Mitev:
> Hi,
>
> On 05/07/2018 04:00 PM, cr33dc0d3r wrote:
> > Hey All,
> >
> > i know about the method to copy a file between Dom0 and DomU's and also about the way how to directly copy a file from AppVM to AppVM with qvm-copy-to-vm.
> >
> > My Question is:
> > Is there a way to execute a command on Dom0 that is like: copy [source-vm][path] [dest-vm][path] ?
>
> you could use `qvm-run sourcevm "qvm-copy /path/to/file` but you'd get a
> popup to select the destination VM and you can't set the destination
> path. Probably not what you want.
>
> Alternatively, pass I/O from one VM to the other with a pipe. For a file:
>
> qvm-run -p sourcevm "cat /path/to/file" | qvm-run -p destvm "cat >
> /path/to/file"
When i tried this, sh and cat throw "No such file or directory" errors.
Already checked: test.txt is in the wanted dir: /home/user/documents/test.txt
Are there Version-specific ways to execute such an command? (Im using R3.2)

Ivan Mitev

unread,
May 7, 2018, 10:49:06 AM5/7/18
to qubes...@googlegroups.com


On 05/07/2018 05:35 PM, cr33d...@gmail.com wrote:
> Hi,
>> Am Montag, 7. Mai 2018 15:15:30 UTC+2 schrieb Ivan Mitev:
>> Hi,
>>
>> On 05/07/2018 04:00 PM, cr33dc0d3r wrote:
>>> Hey All,
>>>
>>> i know about the method to copy a file between Dom0 and DomU's and also about the way how to directly copy a file from AppVM to AppVM with qvm-copy-to-vm.
>>>
>>> My Question is:
>>> Is there a way to execute a command on Dom0 that is like: copy [source-vm][path] [dest-vm][path] ?
>>
>> you could use `qvm-run sourcevm "qvm-copy /path/to/file` but you'd get a
>> popup to select the destination VM and you can't set the destination
>> path. Probably not what you want.
>>
>> Alternatively, pass I/O from one VM to the other with a pipe. For a file:
>>
>> qvm-run -p sourcevm "cat /path/to/file" | qvm-run -p destvm "cat >
>> /path/to/file"
> When i tried this, sh and cat throw "No such file or directory" errors.
> Already checked: test.txt is in the wanted dir: /home/user/documents/test.txt
> Are there Version-specific ways to execute such an command? (Im using R3.2)

Not sure about 3.2 specifics (I'm on 4.0) but it should work too.

I see that the last '/path/to/file' after "cat > was line wrapped.
Are you sure you wrote everything in one line ? Here's the same command,
line escaped:

qvm-run -p sourcevm "cat ~/documents/test.txt" | \
qvm-run -p destvm "cat > ~/test-from-sourcevm.txt"

awokd

unread,
May 12, 2018, 10:19:27 AM5/12/18
to qubes...@googlegroups.com
>>> On 05/07/2018 04:00 PM, cr33dc0d3r wrote:
>>>
>>>> Hey All,
>>>>
>>>>
>>>> i know about the method to copy a file between Dom0 and DomU's and
>>>> also about the way how to directly copy a file from AppVM to AppVM
>>>> with qvm-copy-to-vm.
>>>>
>>>> My Question is:
>>>> Is there a way to execute a command on Dom0 that is like: copy
>>>> [source-vm][path] [dest-vm][path] ?

You might already know this too, but the preferred method for Qubes would
be to use qvm-copy-to-vm so dom0 doesn't get involved in touching the
AppVM's data. You could still start it from dom0 with something like
"qvm-run [source-vm] qvm-copy-to-vm [dest-vm][path]".



Reply all
Reply to author
Forward
0 new messages