本文翻譯自: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
讓我知道是否無效