scp (secure copy) to ec2 instance without password

前端 未结 14 1825
野性不改
野性不改 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 03:50

    Just tested:

    Run the following command:

    sudo shred -u /etc/ssh/*_key /etc/ssh/*_key.pub
    

    Then:

    1. create ami (image of the ec2).
    2. launch from new ami(image) from step no 2 chose new keys.
    0 讨论(0)
  • 2020-12-02 03:53

    To use PSCP, you need the private key you generated in Converting Your Private Key Using PuTTYgen. You also need the public DNS address of your Linux instance

    pscp -i C:\path\my-key-pair.ppk C:\path\Sample_file.txt ec2-user@public_dns:/home/ec2-user/Sample_file.txt
    
    0 讨论(0)
  • 2020-12-02 03:55

    I was hung up on this because I was specifying my public key file in

    scp -i [private key file path]
    

    When I caught that mistake and changed it to the private key path instead, I was all set.

    0 讨论(0)
  • 2020-12-02 03:57

    I figured it out. I had the arguments in the wrong order. This works:

    scp -i mykey.pem somefile.txt root@my.ec2.id.amazonaws.com:/
    
    0 讨论(0)
  • 2020-12-02 04:01

    My hadoopec2cluster.pem file was the only one in the directory on my local mac, couldn't scp it to aws using scp -i hadoopec2cluster.pem hadoopec2cluster.pem ubuntu@serverip:~.

    Copied hadoopec2cluster.pem to hadoopec2cluster_2.pem and then scp -i hadoopec2cluster.pem hadoopec2cluster_2.pem ubuntu@serverip:~. Voila!

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

    write this code

    scp -r -o "ForwardAgent=yes" /Users/pengge/11.vim root@192.168.2.228:/root/
    

    If you have a SSH key with access to the destination server and the source server does not, adding -o "ForwardAgent=yes" will allow you to forward your SSH agent to the source server so that it can use your SSH key to connect to the destination server.

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