1

I can successfully SSH into my remote sever (amazon web services if that matters, I'm on a mac) using

ssh -i mykey.pem ubuntu@??.??.??.???

But when I try to use scp

scp -i test.php mykey.pem ubuntu@??.??.??.???

I get

scp: /test.php: Permission denied

My guess is that there something wrong with my permissions for test.php?
How would I change that?

I tried sudo and that did not work. Same error.

1
  • The second command you provided is plainly wrong, but will not result in the error you claim you get.
    – techraf
    Feb 20, 2016 at 22:15

2 Answers 2

2

Your command order is wrong:

scp -i mykey.pem test.php ubuntu@??.??.??.???:

-i is to flag the private key (in this case, mykey.pem). Also it was missing the : at the end of the host

0

I experienced similar problems, same error message, before as well and have fixed it. Even though you can log into your remote server that doesn't mean you have access to all of the directories on the remote server. Make sure that you have access to the directory you are copying to. Try to avoid copying it to "/" since your access point for the remote server is likely not the root and the full path is possibly not shown to you. Use relative paths instead and that might fix your problem. Hope that helps!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .