我正在尝试使用 SCP 将文件从我的本地主机复制到我的 Amazon EC2 实例并收到错误:
警告:身份文件 blocks_key.pem 不可访问:没有这样的文件或目录。权限被拒绝(公钥)。失去了连接
提示这个错误的命令是:
scp -i ~/Desktop/Blocks/blocks_key.pem ~/Desktop/Blocks/code/www/uploadtest.html ubuntu@ip.address:/var/www
Run Code Online (Sandbox Code Playgroud)
我能够使用相同的 -i ~/Desktop/Blocks/blocks_key.pem 进行 SSH,所以我不清楚为什么这不能正常工作。任何见解将不胜感激!
调试信息:
OpenSSH_5.3p1 Debian-3ubuntu7, OpenSSL 0.9.8k 25 Mar 2009
Warning: Identity file /Desktop/Blocks/blocks_key.pem not accessible: No such file or directory.
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 184.73.234.234 [184.73.234.234] port 22.
debug1: Connection established.
debug1: identity file /home/ubuntu/.ssh/identity type -1
debug1: identity file /home/ubuntu/.ssh/id_rsa type -1
debug1: identity file /home/ubuntu/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3p1 Debian-3ubuntu7
debug1: match: OpenSSH_5.3p1 Debian-3ubuntu7 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3p1 Debian-3ubuntu7
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host '184.73.234.234' is known and matches the RSA host key.
debug1: Found key in /home/ubuntu/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/ubuntu/.ssh/identity
debug1: Trying private key: /home/ubuntu/.ssh/id_rsa
debug1: Trying private key: /home/ubuntu/.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).
lost connection
Run Code Online (Sandbox Code Playgroud)
谢谢
也许你发现了一个错误?
做同样事情的另一种方式(想知道这对你有用吗?):
scp -oIdentityFile=/Users/emmie/Desktop/Blocks/blocks_key.pem ~/Desktop/Blocks/code/www/uploadtest.html ubuntu@ip.address:/var/www
此外,如果您发布以下输出,它可能会有所帮助(只是好奇):
stat /Users/emmie/Desktop/Blocks/blocks_key.pem
归档时间: |
|
查看次数: |
24302 次 |
最近记录: |