I've got a virtual machine running on KVM on my localhost. I can ssh into it without problems using hostname (entered in /etc/hosts) or the IP address.


scp root@remote:/somefile root@localvm:/

I get

ssh: Could not resolve hostname localvm: Name or service not known

Using the IP address it says:

ssh: connect to host port 22: Network is unreachable

This is interesting, I have no clue right now.

Edit: The localvm is not known on the remote host, this must be the problem.

1 Answer 1


Using synopsis scp host1: host2:, then the scp first connects to the first host1 and then tries to connect to the host2 from there (unfortunately not described in manual page). This means that the host2 have to be resolvable from host1 and also you need to be able to authenticate to this host from host1.

There is a note in manual page for scp:


Copies between two remote hosts are transferred through the local host. Without this option the data is copied directly between the two remote hosts. Note that this option disables the progress meter.

This explains this behavior and how to workaround it: scp -3 host1: host2: will resolve both host from you local host and will work for you just fine.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .