2016-02-12 110 views
1

連接到我的AWS服務器複製多個文件時,此命令行之有效無法通過scp

ssh -i my_pem.pem [email protected] 

但是,這並不:

$ scp -v -i my_pem.pem file1 file2 [email protected]:/home/ubuntu/folder1 

UPDATE1

$ ssh -v -i 123.pem [email protected] 
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 [email protected] none 
debug1: kex: client->server aes128-ctr [email protected] 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 [email protected] 
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 

這是怎麼回事?

+0

什麼呢?對於爲什麼不使用相同的dyntax,只是-i – datelligence

+0

@datelligence,你爲什麼不打開文檔的-v stsnds? –

+0

「無法解析主機名」看起來不像'scp'和更多文件,但與您的網絡有關。你在'〜/ .ssh/config'文件中有什麼?嘗試在命令行中添加更多'-vvv'來查看更多日誌。你的主機名在從'scp'到'ssh'的路上丟失了某個地方 – Jakuje

回答

1

看到區別

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 

scp被連接別的地方,因爲你混淆的IP地址/地址我不知道,如果這是有意或者說,它確實。

scp是解析您的文件,並可能會發現在你的文件名部分:字符(第一猜測@是假的),並分析該文件名作爲host:path?只用其中一個文件嘗試一下,發佈文件的真實名稱。

或寧可使用sftp。它不關心命令行上的語法。就在sftp your host然後:

cd folder1 
put my_file file2 
+0

**您的scp正在連接到其他地方,並且由於您將IP /地址混淆了**我認爲這只是一個真實的IP地址,因爲在命令中,我在文件名中使用主機名稱 –

+0

否「:」。 –