-1

i have a problem in uploading the folder from my laptop to my instance on amazon. i tried a lot of commands in my local machine like

sudo scp  -i my_key.pem -r my_folder/path public_DNS:home/ec2-user/new_folder/

but got every time i tried this line

Please login as the user "ec2-user" rather than the user "root".

1 Answer 1

0

The options for scp are similar to ssh in that you need to specify the username if you do not want to connect using your own. By having sudo in front of the command, you’re running scp as root, which is being passed to the connection string because you’ve not defined something different.

Try this:

scp  -i ~/.ssh/my_key.pem -r /path/to/source [email protected]:/home/ec2-user/destination/

Be sure to change the various details for your situation, and be sure that the destination directory already exists as it will not be created by scp.

You must log in to answer this question.

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