本文翻译自:scp (secure copy) to ec2 instance without password
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.
我有一个正在运行的EC2实例(FreeBSD 9 AMI ami-8cce3fe5),我可以使用我的亚马逊创建的密钥文件将其ssh进入,而无需输入密码提示,没有问题。However, when I want to copy a file to the instance using scp I am asked to enter a password:
但是,当我想使用scp将文件复制到实例时,要求输入密码:scp somefile.txt -i mykey.pem [email protected]:/
Password:
Any ideas why this is happening/how it can be prevented?
有什么想法为什么会发生/如何预防?#1楼
参考:https://stackoom.com/question/RW3U/scp-安全副本-到ec-实例-无需密码
#2楼
scp -i /home/barkat/Downloads/LamppServer.pem lampp_x64_12.04.tar.gz
这对你们所有人都非常有帮助
#3楼
scp -i /path/to/your/.pemkey -r /copy/from/path [email protected]:/copy/to/path
#4楼
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 [email protected]:~
.
我的hadoopec2cluster.pem
文件是本地Mac上目录中的唯一文件,无法使用 scp -i hadoopec2cluster.pem hadoopec2cluster.pem [email protected]:~
其scp到aws scp -i hadoopec2cluster.pem hadoopec2cluster.pem [email protected]:~
。 Copied hadoopec2cluster.pem to hadoopec2cluster_2.pem and then
scp -i hadoopec2cluster.pem hadoopec2cluster_2.pem [email protected]:~
.
将hadoopec2cluster.pem复制到hadoopec2cluster_2.pem,然后将scp -i hadoopec2cluster.pem hadoopec2cluster_2.pem [email protected]:~
复制到hadoopec2cluster_2.pem scp -i hadoopec2cluster.pem hadoopec2cluster_2.pem [email protected]:~
。 Voila!
瞧!#5楼
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.
当我发现该错误并将其更改为私钥路径时,一切都准备就绪。#6楼
lets assume that your pem file and somefile.txt you want to send is in Downloads folder
假设您要发送的pem文件和somefile.txt位于“下载”文件夹中scp -i ~/Downloads/mykey.pem ~/Downloads/somefile.txt [email protected]:~/
let me know if it doesn't work
让我知道是否无效