SCP 到 EC2 不工作
SCP to EC2 not working
所以我有一个 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
它似乎没有提供您告诉它的 .pem
文件。 .pem
是否被 600
的权限锁定?
可能发生的另一件事:客户端或服务器中的一个或两个拒绝尝试超过设定数量的 public 个键,因此将 -F /dev/null
添加到您的 scp 命令中,所以您的客户不会发送任何额外的密钥(id_dsa
、id_ecdsa
等)。
所以我有一个 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
它似乎没有提供您告诉它的 .pem
文件。 .pem
是否被 600
的权限锁定?
可能发生的另一件事:客户端或服务器中的一个或两个拒绝尝试超过设定数量的 public 个键,因此将 -F /dev/null
添加到您的 scp 命令中,所以您的客户不会发送任何额外的密钥(id_dsa
、id_ecdsa
等)。