scp (secure copy) to ec2 instance without password
403,975
Solution 1
I figured it out. I had the arguments in the wrong order. This works:
scp -i mykey.pem somefile.txt [email protected]:/
Solution 2
scp -i /path/to/your/.pemkey -r /copy/from/path user@server:/copy/to/path
Solution 3
copy a file from a local server to a remote server
sudo scp -i my-pem-file.pem ./source/test.txt [email protected]:~/destination/
copy a file from a remote server to a local machine
sudo scp -i my-pem-file.pem [email protected]:~/source/of/remote/test.txt ./where/to/put
So the basically syntax is:-
scp -i my-pem-file.pem username@source:/location/to/file username@destination:/where/to/put
-i
is for the identity_file
Solution 4
I've used below command to copy from local linux Centos 7 to AWS EC2.
scp -i user_key.pem file.txt [email protected]:/home/ec2-user
Solution 5
Making siliconerockstar's comment an answer since it worked for me
scp -i kp1.pem ./file.txt [email protected]:/home/ec2-user
Author by
Hoff
Updated on February 08, 2022Comments
-
Hoff about 2 years
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 [email protected]:/ Password:
Any ideas why this is happening/how it can be prevented?