rsync to EC2: Identity file not accessible

Posted by Richard on Server Fault See other posts from Server Fault or by Richard
Published on 2012-11-19T13:24:00Z Indexed on 2012/11/19 23:06 UTC
Read the original article Hit count: 312

Filed under:
|
|

I'm trying to rsync a file over to my EC2 instance:

 rsync -Paz --rsh "ssh -i ~/.ssh/myfile.pem" --rsync-path "sudo rsync" file.pdf [email protected]:/home/ubuntu/

This gives the following error message:

Warning: Identity file ~/.ssh/myfile.pem not accessible: No such file or directory.
[email protected]'s password: 

The pem file is definitely located at the path ~/.ssh/myfile.pem, though: vi ~/.ssh/myfile.pem shows me the file.

If I remove the remote path from the very end of the rsync command:

rsync -Paz --rsh "ssh -i ~/.ssh/myfile.pem" --rsync-path "sudo rsync" file.pdf [email protected]

Then the command appears to work...

building file list ... 
1 file to consider
file.pdf
       41985 100%    8.79MB/s    0:00:00 (xfer#1, to-check=0/1)
sent 41795 bytes  received 42 bytes  83674.00 bytes/sec
total size is 41985  speedup is 1.00

...but when I go to the remote server, nothing has actually been transferred.

What am I doing wrong?

© Server Fault or respective owner

Related posts about amazon-ec2

Related posts about rsync