I'm able to ssh -i mykey.pem
to EC2. I'm able to scp -i mykey.pem
to EC2. But when I try to rsync -avz -e "ssh -i mykey.pem"
I get this error:
Warning: Identity file mykey.pem not accessible: No such file or directory.
Permission denied (publickey).
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(605) [sender=3.0.9]
Any suggestions what I've done wrong?
Make sure the
.pem
file is indeed where you think.Try
rsync -avz -e "ssh -i ./mykey.pem"
using a./
.Note: For that example, your
.pem
must be inside the current working directory. If it's elsewhere, then change it to use an absolute path (/home/me/path/to/file.pem
)As a debugging angle, try running
ssh-agent
in your shell session as described in this SO answer on a similar question. Basically, you runssh-agent
locally, add your key, and then see ifrsync
picks it up properly. The idea is to flush out some other error, hopefully providing some insight into the real problem (since we've come up dry in the comments).Command string is this:
This works in my environment for access to my AWS systems.