The Computer Oracle

How to rsync with a private key?

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Forest of Spells Looping

--

Chapters
00:00 How To Rsync With A Private Key?
00:41 Accepted Answer Score 11
01:33 Thank you

--

Full question
https://superuser.com/questions/453303/h...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#macos #ubuntu #rsync #filetransfer #azure

#avk47



ACCEPTED ANSWER

Score 11


The command fails not because of wrong keys, but because you're telling rsync to run my/file instead of ssh (by using the -e option, which picks up the word following it). Remove the -e option first.

Since rsync normally uses ssh to connect, you can configure both to always use a particular key for connecting to cloudapp. For example, put this at the top of your ~/.ssh/config file:

Host me.cloudapp.net
    Username me
    IdentityFile ~/my-cloudapp-key.key
    IdentitiesOnly yes

The Username me part will also let you skip adding me@ when using ssh or rsync. Plain rsync -avz my/file me.cloudapp.net:/my/path will work.


Note: SSH keys are not X.509 certificates; they're just plain RSA or ECDSA keypairs without any additional information.