4

When I try to copy files between two hosts, of which the second is identified by an alias:

scp host:foo alias:

scp tries to resolve alias by looking into host:.ssh/config and not my local ~/.ssh/config -- in other words, as if I've ssh-ed to host and then executed scp foo alias:.

Of course, this fails if I do not have the alias alias defined on host. Is this the intended behavior?

Running Ubuntu 13.04.

1 Answer 1

13

Indeed, the scp host1:foo host2: is the same as doing the scp foo host2: on the host1 (The scp, more or less, first connects to the host1 and executes the scp foo host2: there).

If you want to transfer files via a local host (what I believe would also mean the alias is resolved locally), add the -3 switch:

-3: Copies between two remote hosts are transferred through the local host. Without this option the data is copied directly between the two remote hosts.

https://man.openbsd.org/scp

1
  • 2
    Oh God. scp has options -1, -2, -3, -4 and -6 with three different "groups" of meanings. Shudder Anyway, thanks, that's it.
    – Irfy
    Jun 2, 2013 at 23:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.