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.

Irfy
  • 257

1 Answers1

14

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

  • 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 02 '13 at 23:25