Copy (scp without password) files to Amazon EC2 instance

While copying files (scp) to Amazon EC2 instance, got the following error:

$ scp ~/Downloads/pcre-8.31.tar.gz  -i /Users/khanna/Downloads/k2.pem
Permission denied (publickey).
lost connection

The error message is not that intuitive to debug but after some researching it turned out that the order of arguments was incorrect. This fixes that:

$ scp  -i /Users/khanna/Downloads/k2.pem  ~/Downloads/pcre-8.31.tar.gz

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">