How to use `~/.ssh/config` setting for each server by `rsync`
Specify "myvps"
as the hostname.
rsync /var/bar myvps:/home/foo ...
This did not work for me. I have jump hosting in my ~/.ssh/config
Host 10.x.y.z
User cloud-user
HostName vm-pivot
IdentityFile /path_to_vm_key
Host 21ct-dev1-*
User cloud-user
HostName %h.example.com
ProxyCommand ssh 10.x.y.z -W %h:%p
IdentityFile /path_to_vm_key
rsync -e "ssh" local_path vm-app01:/remote_path
ssh: Could not resolve hostname vm-app01: nodename nor servname provided, or not known rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at /SourceCache/rsync/rsync-42/rsync/io.c(452) [sender=2.6.9]
However, this works just fine
[kbroughton@kbroughton:project + (develop)] ssh vm-app01
Last login: Thu Apr 17 12:10:37 2014 from 10.a.b.c
Edit, I was able to get past the name resolution by forcing rsync ssh to load a config file with -F sudo rsync -az -e "ssh -F /Users/kbroughton/.ssh/config"
This gets past one error but onto another. Permission denied (publickey,gssapi-keyex,gssapi-with-mic). ssh_exchange_identification: Connection closed by remote host
Also tried explicitly setting -i and user@ in the connection but same error occurs.
Another data point. If i use the floating ip of the pivot vm (jump host) instead of its name vm-pivot rsync works. But explicitly dumping all my ssh/config in the -e "ssh" does not work. Details: local mac, upgraded to rsync 3.1.0, remote centos rsync 3.0.9.
[kbroughton@kbroughton:project + (develop)] sudo /usr/local/bin/rsync -az -e "ssh -F /Users/kbroughton/.ssh/config -i /Users/kbroughton/.ssh/identities/vm_key -W 10.x.y.z:22" /var/data/sources/data.tar.gz user@vm-pivot:/home/user
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
ssh_exchange_identification: Connection closed by remote host
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.0]
[kbroughton@kbroughton:project + (develop)] sudo /usr/local/bin/rsync -az -e "ssh -F /Users/kbroughton/.ssh/config -i /Users/kbroughton/.ssh/identities/vm_key -W 10.x.y.z:22" /var/data/sources/data.tar.gz [email protected]:/home/user
protocol version mismatch -- is your shell clean?
(see the rsync man page for an explanation)
rsync error: protocol incompatibility (code 2) at compat.c(181) [sender=3.1.0]
This works
[kbroughton@kbroughton:project + (develop)] sudo /usr/local/bin/rsync -az -e "ssh -F /Users/kbroughton/.ssh/config -i /Users/kbroughton/.ssh/identities/vm_key" /var/data/sources/data.tar.gz [email protected]:/home/user