Rsync Over SSH Using Alternate Port and Private Key
June 1st, 2008A previous post described how to set up a public/private key to log in to my disk station without a password and using an alternate port i.e. not port 22.
One of the consequences of this is that rsync no longer works without a few tweaks since by default it works over port 22 and expects a password.
To fix this just use the command below and rsync will work without interaction (assuming the key passphrase was left empty).
# rsync -au -e 'ssh -p 99 -i /home/username/.ssh/id_rsa' /path/to/source HOST:/path/to/destination
Just replace -p 99 with your SSH port and /home/username/.ssh/id_rsa with the location of you private key.
February 15th, 2010 at 2:19 am
I had a similar set up with public/private key pair, it seem to work for me without the ‘-i /home/username/.ssh/id_rsa’ stuff.