我一直尝试将文件夹从远程服务器复制到本地,看到了许多其他问题并尝试了不少解决方案,但对我来说并没有什么用。
这是我的命令:
scp -r -i /Users/development/key.pem ec2-user@ip:/var/www/targetlocalfolder /Users/development/targetremotefolder
详细日志
debug1: kex: curve25519-sha256 need=64 dh_need=64
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:B7wHnM5MvhOy5PEYLGb0bHf/mPOgGIYFUzNYHBtzo5w
debug3: hostkeys_foreach: reading file "/home/ec2-user/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /home/ec2-user/.ssh/known_hosts:7
debug3: load_hostkeys: loaded 1 keys from xx
debug1: Host 'xx' is known and matches the ECDSA host key.
debug1: Found key in /home/ec2-user/.ssh/known_hosts:7
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey after 134217728 blocks
debug2: key: /home/ec2-user/.ssh/id_rsa (0x564298469010)
debug2: key: /home/ec2-user/.ssh/id_dsa ((nil))
debug2: key: /home/ec2-user/.ssh/id_ecdsa ((nil))
debug2: key: /home/ec2-user/.ssh/id_ed25519 ((nil))
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey
debug3: start over, passed a different list publickey
debug3: preferred gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/ec2-user/.ssh/id_rsa
debug3: send_pubkey_test
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/ec2-user/.ssh/id_dsa
debug3: no such identity: /home/ec2-user/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /home/ec2-user/.ssh/id_ecdsa
debug3: no such identity: /home/ec2-user/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /home/ec2-user/.ssh/id_ed25519
debug3: no such identity: /home/ec2-user/.ssh/id_ed25519: No such file or directory
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
Permission denied (publickey).
密钥.pem CHMOD 400
谁能帮我?
答案1
显然我只能在同一个终端中执行 SSH 或 scp 操作。因此,对我来说,解决方案是打开两个终端 - 一个用于 SSH,另一个用于 scp。