When I attempt to perform a
scp user1@host1:somfile user2@host2:somfile
Host key verification failed.
The authentication to both hosts is ssh-key based, however for security reasons the private key is only stored on the host that issues the above command.
Another complication in this setup is, that host2 is SFTP-only, so no shell access there.
I tested with an older openssl/openssh (Debian lenny openssh-client 5.1) combination and a with latest openssl/openssh releases built from source (openssl 1.0.0c, openssh 5.8) as well. Same behavior.
It's also woth to mention that executing
scp user1@host1:somfile somfile
scp somfile user2@host2:somfile
sequentially through a temp file works.
What am I'm doing wrong here?