Bug 2884

Summary: scp doesn't read ~/.ssh/config for second argument
Product: Portable OpenSSH Reporter: Sam Bull <axd4ho>
Component: scpAssignee: Assigned to nobody <unassigned-bugs>
Status: CLOSED INVALID    
Severity: enhancement CC: dtucker
Priority: P5    
Version: 7.2p2   
Hardware: Other   
OS: Linux   

Description Sam Bull 2018-07-20 02:23:37 AEST
When I run 'scp -v A B', it seems that my user config is not read for B. Looking closer at the output, it looks like the config is read to open a connection to A, and the the ssh connection to B is made from within the connection to A.

So, I'm assuming that means it is only reading the config files that are installed with the host A. But, I was initially expecting it to be run from my local machine, and therefore get the config from there.

If this is the desired default behaviour, it would be nice to have an option that reads the ssh configs on the local machine for B and then passes any configuration options through to A.
Comment 1 Darren Tucker 2018-07-20 09:14:35 AEST
In your example both A and B are host:/path ie a remote to remote copy?  If you want both connections to be made from A there's the three-way option to scp:

  -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.  Note that this option disables the
      progress meter.

although that also has different behaviour in that the bytes will pass through the originating host instead of directly from A to B.
Comment 2 Sam Bull 2018-07-21 01:24:37 AEST
Ah, didn't see that option. Suppose that's a good enough solution, as it also ensures no sensitive data from the config leaves the local machine (e.g. my problem was that I needed the ProxyCommand containing a port knocking sequence).
Comment 3 Damien Miller 2021-04-23 14:56:27 AEST
closing resolved bugs as of 8.6p1 release