Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in AWS by (19.1k points)

I have an EC2 instance running and I am able to SSH into it.

However, when I try to rsync, it gives me the error Permission denied (publickey).

The command I'm using is:

rsync -avL --progress -e ssh -i ~/mykeypair.pem ~/Sites/my_site/* [email protected]:/var/www/html/

I also tried

rsync -avz ~/Sites/mysite/* -e "ssh -i ~/.ssh/" [email protected]:/var/www/html/

1 Answer

0 votes
by (44.3k points)

So, you can put your ssh statements inside quotations and also use the full path to the private key. Try to use the full path wherever required.

rsync -avL --progress -e "ssh -i /path/yourkeypair.pem" \

       ~/Sites/my_site/* \ 

       [email protected]:/var/www/html/

This will surely help you.

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers


94.1k users

Browse Categories