Rsync 到 Amazon Ec2 实例 [英] Rsync to Amazon Ec2 Instance
本文介绍了Rsync 到 Amazon Ec2 实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个 EC2 实例正在运行,我可以通过 SSH 连接到它.
I have an EC2 instance running and I am able to SSH into it.
但是,当我尝试 rsync 时,它给了我错误 Permission denied (publickey).
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/
这似乎奏效了.
这篇关于Rsync 到 Amazon Ec2 实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文