SCP到EC2无法正常工作

时间:2016-03-17 21:23:43

标签: amazon-web-services amazon-ec2 scp

所以我有一个pem文件:

./test.pem

我有一个文件要移动到我的实例:

path/to/my/file.csv

我想把它移到我的ec2实例:

ec2-user@11.111.111.11

我尝试使用以下方法将文件scp到我的ec2主目录:

scp -i test.pem path/to/my/file.csv ec2-user@11.111.111.11:~

但由于某种原因它会提示我输入密码。知道我错在哪里吗?

-v的输出:

Executing: program /usr/bin/ssh host 11.111.111.11, user ec2-user, command scp -v -d -t ~
OpenSSH_6.9p1, LibreSSL 2.1.8
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to 11.111.111.11 [11.111.111.11] port 22.
debug1: Connection established.
debug1: Local version string SSH-2.0-OpenSSH_6.9
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1
debug1: match: OpenSSH_6.6.1 pat OpenSSH_6.6.1* compat 0x04000000
debug1: Authenticating to 11.111.111.11:22 as 'ec2-user'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: xxxx-xxxx-xxxxxxxx 
debug1: Host '11.111.111.11' is known and matches the ECDSA host key.
debug1: Found key in /Users/me/.ssh/known_hosts:19
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/me/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: /Users/me/.ssh/id_dsa
debug1: Trying private key: /Users/me/.ssh/id_ecdsa
debug1: Trying private key: /Users/me/.ssh/id_edxxxxx
debug1: Next authentication method: password

1 个答案:

答案 0 :(得分:1)

看起来它没有提供您告诉它的.pem文件。是.pem是否已锁定600的权限?

可能发生的另一件事:客户端或服务器中的一个或两个拒绝尝试超过一定数量的公钥,因此将-F /dev/null添加到您的scp命令,以便您的客户端不会发送任何额外的键(id_dsaid_ecdsa等)。