Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rsync over ssh with key gets error EC2

I can ssh into my EC2 with:

ssh -i /Users/User/Downloads/key.pem [email protected]

My directory:

/A
   /B
      /folderToTransfer

I can rsync into the same directory with:

rsync -avrz -e “ssh -i /Users/User/Downloads/key.pem”   / 
/Users/User/Documents/Programming/A/B/folderToTransfer  /
[email protected]

New directory:

/A
   /B
      /folderToTransfer
      /[email protected]

But this fails (when adding :~/ to the end)

rsync -avrz -e “ssh -i /Users/User/Downloads/key.pem”   / 
/Users/User/Documents/Programming/A/B/folderToTransfer  /
[email protected]:~/

With the error

rsync: Failed to exec ?\#200\#234ssh: No such file or directory (2)
rsync error: error in IPC code (code 14) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-47/rsync/pipe.c(86) [sender=2.6.9]
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-47/rsync/io.c(453) [sender=2.6.9]

Others don't seem to have this same problem when rsyncing with ssh -i, what have I done wrong?

like image 314
user25093 Avatar asked May 12 '26 21:05

user25093


1 Answers

rsync -avrz -e “ssh -i /Users/User/Downloads/key.pem”   / 
               ^                                    ^

You're not using the ASCII double quote character " here. You're using some kind of open- and close-quote characters intended for typesetting. Your command is failing because the shell doesn't treat these characters as quote marks; rsync ends up trying to execute a program named “ssh.

Replace the characters with ASCII double quotes:

rsync -avrz -e "ssh -i /Users/User/Downloads/key.pem"   / 
like image 195
Kenster Avatar answered May 14 '26 17:05

Kenster



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!