scp (secure copy) to ec2 instance without password

前端 未结 14 1827
野性不改
野性不改 2020-12-02 03:32

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, whe

相关标签:
14条回答
  • 2020-12-02 04:04

    lets assume that your pem file and somefile.txt you want to send is in Downloads folder

    scp -i ~/Downloads/mykey.pem ~/Downloads/somefile.txt root@my.ec2.id.amazonaws.com:~/
    

    let me know if it doesn't work

    0 讨论(0)
  • 2020-12-02 04:04

    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're scp-ing has adequate permissions for the user you're SSH-ing.

    0 讨论(0)
  • 2020-12-02 04:05
    scp -i ~/.ssh/key.pem ec2-user@ip:/home/ec2-user/file-to-copy.txt .
    

    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.

    0 讨论(0)
  • 2020-12-02 04:08

    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
    
    0 讨论(0)
  • 2020-12-02 04:09

    I've used below command to copy from local linux Centos 7 to AWS EC2.

    scp -i user_key.pem file.txt ec2-user@my.ec2.id.amazonaws.com:/home/ec2-user
    
    0 讨论(0)
  • 2020-12-02 04:09

    scp -i /home/barkat/Downloads/LamppServer.pem lampp_x64_12.04.tar.gz

    this will be very helpful to all of you guys

    0 讨论(0)
提交回复
热议问题