Bug 2020 - Remote-to-remote copying doesn't work when second host not on port 22
Summary: Remote-to-remote copying doesn't work when second host not on port 22
Status: CLOSED INVALID
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: scp (show other bugs)
Version: 6.0p1
Hardware: All All
: P2 normal
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-21 17:46 AEST by Daniel Kullmann
Modified: 2015-08-11 23:04 AEST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Kullmann 2012-06-21 17:46:14 AEST
It is not possible to specify a different port for the second remote host in a scp command line, e.g.

scp -P 3434 host1:file -P 8765 host2:file

is not possible, because the second -P is in an illegal position.

This would not be bad if the port could be specified in another way, but scp does not use the Port setting in .ssh/config for the second host. It does use the setting for the first host, though.
Comment 1 Darren Tucker 2012-06-21 19:44:01 AEST
Actually it *is* looked up in ~/.ssh/config, but on the remote host.

By default, scp remote1:foo remote2:bar actually runs "ssh remote1 scp foo remote2:bar" (this is behaviour inherited from rcp).

You need to either put the port number in the config file on the remote host, or use scp's "-3" option to do a 3-way copy which will use the local config file.
Comment 2 Daniel Kullmann 2012-06-21 23:58:30 AEST
OK, thanks for clearing that up.
Comment 3 Damien Miller 2015-08-11 23:04:24 AEST
Set all RESOLVED bugs to CLOSED with release of OpenSSH 7.1