Issue
I am trying to copy files to an AWS instance using SCP but am running into permission denied error as below,i tried to change the group name to "Users" as well which didnt work either?can anyone provide guidance on how to fix this?
drwx------+ 1 username NA+Group(513) 0 May 10 23:33 .ssh
-rwxr-xr-x 1 Administrators NA+Group(513) 1692 May 5 17:00 ngc.pem
-rwxr-xr-x 1 Administrators NA+Group(513) 1692 May 8 12:47 test.pem
-rwxr-xr-x 1 Administrators NA+Group(513) 1464 May 8 13:45 test.ppk
username@machine ~
$ scp -i test.pem index.html ec2-publicip.us-west-2.compute.amazonaws.com:~
Permission denied (publickey).
lost connection
username@machine ~
$ chown usernam1 test.pem
chown: changing ownership of 'test.pem': Permission denied
username@machine ~
$ chown :Users test.pem
chown: changing group of 'test.pem': Permission denied
Solution
Permission denied does not relate to the permissions of the .pem file in your computer, but to the permissions of the .pem file to the server it is trying to access. First - you need to specify the specific user you are trying to scp into. For example, if this is an Ubuntu server, the correct syntax for the command would be - scp -i test.pem index.html [email protected]:.
, that will copy the file to the home folder of the ubuntu user.
Answered By - Yaron Idan