I need to do a rsync from a target server with a server in the middle and I have the same public key on both the target and middle server. I want to use that key so I don't have to do password authentication.
local --ssh--> middle --ssh--> target
Reading Method 1 of Using rsync through a firewall makes it seems like this is doable but I have been able to figure out the ssh part of the syntax of the command yet.
When I try
ssh -i $KEY -A user@middle ssh user@target
Permission denied, please try again. Permission denied, please try again. Permission denied (publickey,password).
Clearly the agent forwarding isn't happening as I was expecting it to.
Ideally I'd like to fit it all in one command without have to put anything in ~/.ssh/config files. What are all of the steps to do an rsync in this situation?