无法通过scp复制多个文件

时间:2016-02-12 10:15:25

标签: ssh amazon-ec2 scp

此连接我的aws服务器的命令效果很好

ssh -i my_pem.pem ubuntu@ec2-xx-xx-xx-xx.eu-west-1.compute.amazonaws.com

但这不是:

$ scp -v -i my_pem.pem file1 file2 ubuntu@ec2-xx-xx-xx-xx.eu-west-1.compute.amazonaws.com:/home/ubuntu/folder1

UPDATE1

$ ssh -v -i 123.pem ubuntu@xx-xx-xx-xx.xx-west-1.compute.amazonaws.com
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to xx-xx-xx-xx.xx-west-1.compute.amazonaws.com [11.22.33.44] port 22.
debug1: Connection established.
debug1: identity file docs/toh_server.pem type -1
debug1: identity file docs/toh_server.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.4
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.4 pat OpenSSH_6.6.1* compat 0x04000000
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5-etm@openssh.com none
debug1: kex: client->server aes128-ctr hmac-md5-etm@openssh.com none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA xx:bb:cc:dd:ee:fdsfdsfdsfdsfdsfds
debug1: Host 'xx-xx-xx-xx.xx-west-1.compute.amazonaws.com' is known and matches the ECDSA host key.
debug1: Found key in /home/me123/.ssh/known_hosts:19
debug1: ssh_ecdsa_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: docs/toh_server.pem
debug1: key_parse_private2: missing begin marker
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
Authenticated to xx-xx-xx-xx.xx-west-1.compute.amazonaws.com ([11.33.44.55]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_HK.UTF-8
Welcome to Ubuntu 14.04.3 LTS (GNU/Linux 3.13.0-48-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

 System information disabled due to load higher than 2.0

  Get cloud support with Ubuntu Advantage Cloud Guest:
    http://www.ubuntu.com/business/services/cloud

错误:

Executing: program /usr/bin/ssh host ip-xx-xx-xx-xx, user ubuntu, command scp -v -d -t /home/ubuntu/folder1
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
ssh: Could not resolve hostname ip-xx-xx-xx-xx: Name or service not known
lost connection

问题是什么?

1 个答案:

答案 0 :(得分:0)

查看差异

$(window).bind('resize', function() { 
   setTimeout(function(){ 
       var slider = $('.flexslider').data('flexslider');   
       slider.resize();
   }, 500); 
});

debug1: Connecting to xx-xx-xx-xx.xx-west-1.compute.amazonaws.com [11.22.33.44] port 22.

您的Executing: program /usr/bin/ssh host ip-xx-xx-xx-xx, user ubuntu, command scp -v -d -t /home/ubuntu/folder1 ssh: Could not resolve hostname ip-xx-xx-xx-xx: Name or service not known 正在连接其他地方,因为您对IP /地址进行了模糊处理,我不知道这是不是意图还是确实存在。

scp正在解析您的文件,并且可能在您的文件名中找到了一些scp字符(首先猜测:是假的)并将该文件名解析为@?尝试只使用其中一个文件,发布文件的真实名称。

或者更确切地说使用host:path。它不关心命令行上的语法。只需sftp然后:

sftp your host