Hi, I think I stumbled on a bug while trying to copy some database backups between two servers. Since both of the machines in question have only key auth available and I don't want to put my key on neither one of them I decided to copy over the data using scp since it supports having both the source and destination as remote hosts. One of the machines (build.koparo.com) is running ssh on a non standard port and the second one is running on the default port. I decided to add an entry to ~/.ssh/config for the build.koparo.com machine in order to avoid any additional flags for the command while copying over the files. I tested my config file by doing a regular ssh to the build.koparo.com machine without using the -p parameter and it worked correctly so I issued the copy command and it failed with a lost connection. From there I did several more tests including only the machine running on a non standard port and it seems that the config file is ignored if both ends are remote. [mulander@koparo ~]$ ssh -V OpenSSH_6.6.1p1, OpenSSL 1.0.1g 7 Apr 2014 My ~/.ssh/config file stating that build.koparo.com runs ssh on port 5222 [mulander@koparo ~]$ cat ~/.ssh/config Host build.koparo.com Port 5222 [mulander@koparo ~]$ Copy a remote file from ssh running on port 5222 - properly uses the ~/.ssh/config [mulander@koparo ~]$ scp build.koparo.com:~/case962.patch ./ Enter passphrase for key '/home/mulander/.ssh/id_rsa': case962.patch 100% 1177 1.2KB/s 00:00 [mulander@koparo ~]$ Copy a local file to remote ssh running on port 5222 - properly uses the ~/.ssh/config [mulander@koparo ~]$ scp case962.patch build.koparo.com:~/adam.txt Enter passphrase for key '/home/mulander/.ssh/id_rsa': case962.patch 100% 1177 1.2KB/s 00:00 Copy the same file (adam.txt) on the remote host renaming it to adam2.txt - ~/.ssh/config seems to be ignored [mulander@koparo ~]$ scp build.koparo.com:~/adam.txt build.koparo.com:~/adam2.txt Enter passphrase for key '/home/mulander/.ssh/id_rsa': ssh: connect to host build.koparo.com port 22: Connection refused lost connection [mulander@koparo ~]$ Trying the -F flag to point at the config file directly: [mulander@koparo ~]$ scp -F /home/mulander/.ssh/config build.koparo.com:~/adam.txt build.koparo.com:~/adam2.txt Enter passphrase for key '/home/mulander/.ssh/id_rsa': ssh: connect to host build.koparo.com port 22: Connection refused lost connection [mulander@koparo ~]$ I can properly ssh to the machine - config file is read correctly without me having to specify the port with -p.
As reported by tkoskine on IRC it seems to be related that HOST a config is taken into consideration. The -3 option worked for tkoskine while tunelling traffic through his own host. This hangs for me: mulander@koparo move]$ scp -3 build.koparo.com:~/adam.txt build.koparo.com:~/adam2.txt Enter passphrase for key '/home/mulander/.ssh/id_rsa': Enter passphrase for key '/home/mulander/.ssh/id_rsa': Since I don't have a an ssh agent running. Not sure if this is a bug or feature. I expected my client to negotiate the connection (auth against both boxes) and both ends passing the data after that. Also the connection hanging with no indication is a bit problematic to diagnose.
$ scp user1@host1:source user2@host2:dest When copying between two remote hosts, the host1 is _instructed_ to copy files over to the second host using host1:~user1/.ssh/config and the keys in the same directory. Local config is used to connect to host1 in the first place, _not_ after. Using -3 flag works fine with local config used for both hosts. I would close this as INABIAF.
closing resolved bugs as of 8.6p1 release