0
votes

The instance is launched and I can connect perfectly from my computer. However when I am trying to upload a file to ec2 using the following command:

scp -r -i key.pem path/file ec2-54-195-205-200.eu-west-1.compute.amazonaws.com:/media/ephemeral0/

I have always the following error: Permission denied (publickey). lost connection

1
it is not a permission file problem. Already tried chmod 777 pathuser3333539

1 Answers

1
votes

The username seems to be missing in your scp command. Try adding it before the remote host, separated by a @. For example, with username admin:

scp -r -i key.pem path/file [email protected]:/media/ephemeral0/

The default username in EC2 varies depending on the OS. See this answer for some hints.