scp remoteA:file remoteB:
with scp I can get a file
scp remoteA:file .
and put a file
scp file remoteB:
but when I try
scp remoteA:file remoteB:
I get
ssh: Could not resolve hostname remoteB: Name or service not known
lost connection
why?
EDIT:
the remoteA and remoteB description is in ~/.ssh/config
Solution 1:
likely not related to scp itself, but some sort of name resolution from one host to another. another thing to consider is authentication. it is best you have a passphrase-less key auth from A to B. in which host's .ssh/config you are defining these hosts? scp is not finding that definition. try the real fqdn of the host and it should work fine, if host definition is the problem. also, use -v to see if more details can be found for the error.
Solution 2:
You need to specify a host which remoteA
can reach because the copy is made from remoteA
directly to remoteB
.
To avoid this you can use the -3
option. man scp
says what it does:
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.