我有一个EC2实例运行,我可以SSH到它。
I have an EC2 instance running and I am able to SSH into it.
然而,当我尝试rsync的,它给了我否定的错误权限(公钥)。
However, when I try to rsync, it gives me the error Permission denied (publickey).
我使用的命令是:
rsync -avL --progress -e ssh -i ~/mykeypair.pem ~/Sites/my_site/* root@ec2-XX-XXX-XXX-XXX.us-west-2.compute.amazonaws.com:/var/www/html/
我也试过
rsync -avz ~/Sites/mysite/* -e "ssh -i ~/.ssh/id_rsa.pub" root@ec2-XX-XXX-XXX-XXX.us-west-2.compute.amazonaws.com:/var/www/html/
谢谢
我刚刚收到了同样的错误。我一直一直能的SSH:
I just received that same error. I had been consistently able to ssh with:
ssh -i ~/path/mykeypair.pem \
ubuntu@ec2-XX-XXX-XXX-XXX.us-west-2.compute.amazonaws.com
但是,当使用较长的的rsync 建筑,它似乎会导致错误。我结束了包裹在报价的SSH声明和使用的完整路径的关键。在您的例子:
But when using the longer rsync construction, it seemed to cause errors. I ended up encasing the ssh statement in quotations and using the full path to the key. In your example:
rsync -avL --progress -e "ssh -i /path/to/mykeypair.pem" \
~/Sites/my_site/* \
root@ec2-XX-XXX-XXX-XXX.us-west-2.compute.amazonaws.com:/var/www/html/
这似乎这样的伎俩。