Open a new command prompt and run the following command replacing the fields as needed: scp -P 2222 Source-File-Path user-fqdn @localhost: To copy the entire directory instead of a file, use scp -r before the path. This recursively copies all of the directory's contents to the destination EC2 instance.
To copy the directory from local machine to EC2 instance:scp -i identity_file. pem -r source_dir username@public_ipv4_dns:/remote_dir_path.
Try specifying the user to be ec2-user
, e.g.
scp -i myAmazonKey.pem phpMyAdmin-3.4.5-all-languages.tar.gz [email protected]:~/.
See Connecting to Linux/UNIX Instances Using SSH.
second directory is your target destination, don't use server name there. In other words, you don't need to mention machine name for the machine you're currently in.
scp -i /path/to/your/.pemkey -r /copy/from/path user@server:/copy/to/path
-r if it's a directory.
Your key must not be publicly viewable for SSH to work. Use this command if needed:
chmod 400 yourPublicKeyFile.pem
You should be on you local machine to try the above scp command.
On your local machine try:
scp -i ~/Downloads/myAmazonKey.pem ~/Downloads/phpMyAdmin-3.4.5-all-languages.tar.gz [email protected]:~/.
Here are the details of what works for an EC2 instance:
scp -i /path/to/whatever.pem /users/me/path-to-file [email protected]:~
Few notes for beginning:
-i
scp
stands for secure copy protocol. Knowing the words makes it easier to remember the command.-i
dictates that you need to give the .pem
file as the next param. If there is no -i
, than you do not need a .pem
.:~
at the end of the destination for the EC2 instance. I had exactly same problem, my solution was to
scp -i /path/pem -r /path/file/ ec2-user@public aws dns name:
(leave it blank here)
once you done this part, get into ssh server and mv file to desired location
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With