I have an EC2 instance running (FreeBSD 9 AMI ami-8cce3fe5), and I can ssh into it using my amazon-created key file without password prompt, no problem.
However, when I want to copy a file to the instance using scp I am asked to enter a password:
scp somefile.txt -i mykey.pem root@my.ec2.id.amazonaws.com:/
Password:
Any ideas why this is happening/how it can be prevented?
I was hung up on this because I was specifying my public key file in
When I caught that mistake and changed it to the private key path instead, I was all set.
Making siliconerockstar's comment an answer since it worked for me
scp -i kp1.pem ./file.txt ec2-user@1.2.3.4:/home/ec2-user
The file name shouldnt be between the pem file and the ec2-user string - that doesnt work. This also allows you to reserve the name of the copied file.
In your case, the user
root
won't have any issues. But in certain cases where you're required to login under SSH as a different user, make sure the directory you'rescp
-ing has adequate permissions for the user you're SSH-ing.scp -i /home/barkat/Downloads/LamppServer.pem lampp_x64_12.04.tar.gz
this will be very helpful to all of you guys
I figured it out. I had the arguments in the wrong order. This works: