I have a virtual machine which I launch using following code.
kvm -m 2G -hda image.raw -hdb image.data.qcow2 -redir tcp:11180::80
How can I transfer files from a Linux host to the virtual machine?
You can transfer files using SCP protocol working on the same port as SSH. For that you need to redirect the port 22 on the virtual machine to a local port (2222
in this example):
kvm -m 2G -hda image.raw -hdb image.data.qcow2 -redir tcp:11180::80 -redir tcp:2222::22
and connect with ssh
to that port:
ssh -p 2222 user@localhost
To transfer files you can then use scp
:
scp -p 2222 file.txt user@localhost:file.txt