title: Rsync to Amazon Linux EC2 instance - Permission deniend
body: <p>Just for running a test I want to put an image file into one of my instance folders from my Desktop.</p>
  
  <p>I've tried solutions provided at this same topic question:
  <a href="https://stackoverflow.com/questions/15843195/rsync-to-amazon-ec2-instance">Rsync to Amazon Ec2 Instance</a></p>
  
  <p>So I've tried:</p>
  
  <pre><code>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
  </code></pre>
  
  <p><em>~/.ssh/</em> is where MyKeyPair.pem is located. In fact, to enter via ssh I do first <em>cd ~/.ssh</em> and then I run the <em>ssh -i ...</em> command.</p>
  
  <p>But I'm getting this error:</p>
  
  <pre><code>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]
  </code></pre>
  
  <p>I've read on another Q&amp;A page someone who got this same error reporting he solved it by just installing rsync via yum. In my case it is already installed (version 3.0.6).</p>
  
  <p>I would be grateful if anyone can help!</p>