Rsync for Amazon Linux EC2 instance - deniend permission

Just to run the test, I want to put the image file in one of my instance folders from my desktop.

I tried the solutions provided on the same question: rsync for Amazon Ec2 instance

So I tried:

sudo rsync  -azv --progress -e "ssh -i ~/.ssh/MyKeyPair.pem" \ ~/Desktop/luffy.jpg  \ec2-user@xx.xx.xx.xxx:/home/ec2-user/myproject/mysite/mysite/media

~ / .ssh / is MyKeyPair.pem. In fact, for input via ssh, I do cd ~ / .ssh first and then run the ssh -i command ....

But I get this error:

Warning: Identity file ~/.ssh/MyKeyPair.pem not accessible: No such file or directory.
Permission denied (publickey).
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(600) [sender=3.0.6]

I read on another Q & A page who got the same error saying that he solved it simply by installing rsync via yum. In my case, it is already installed (version 3.0.6).

I would be grateful if anyone would help!

+4
2
  • EC2 rsync , EC2.

  • (~) ​​ , . $HOME.

  • sudo , , , sudo (, ). --rsync-path.

  • -SHAX .

  • "" , , .

:

sudo rsync  -azv -SHAX --progress -e "ssh -i $HOME/.ssh/MyKeyPair.pem" \
  --rsync-path "sudo rsync" \
  ~/Desktop/luffy.jpg \
  ec2-user@xx.xx.xx.xxx:/home/ec2-user/myproject/mysite/mysite/media/

, rsync EC2. "ubuntu" "ec2-user" Amazon Linux.

http://alestic.com/2009/04/ubuntu-ec2-sudo-ssh-rsync

, , , .

+4

! . sudo:

sudo rsync -azv --progress -e "ssh -i $HOME/<path_to>" \
  --rsync-path "rsync" \
  <source> \
  <target>
-1

All Articles