Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

migrated from May 31 '13 at 19:15

This question came from our site for professional and enthusiast programmers.

up vote 7 down vote accepted

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

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

-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.

share|improve this answer
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 '13 at 23:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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