Erro ao tentar copiar arquivos com scp

1

Estou conectando a uma instância do ubunto, executando alguns testes do Apache / JMeter, e tentando usar o scp para pegar os arquivos de log dos testes.

Eu conecto com o seguinte comando:

ssh my-host.amazonaws.com -l my-username

Consigo me conectar e posso executar os testes. No entanto, eu ainda tenho que executar um comando scp sem um erro.

Estou usando o seguinte comando:

scp [email protected]:~/my-file-name.jtl ./

Eu recebo imediatamente o seguinte erro:

Permission denied (publickey).

Alguma ideia de qual poderia ser o problema? Eu tenho direitos para se conectar à máquina em primeiro lugar. Além disso, o nome de usuário "my-username" é compartilhado por alguns usuários de teste, e outros são capazes de executar o comando scp sem problemas.

Edit: aqui está minha saída de tentar o comando scp com o argumento -v:

my-username@ip-xx-xx-xxx-xx:~$ scp -v 
    [email protected]:/home/ubuntu/jmeter.log ./
Executing: program /usr/bin/ssh host my-host.amazonaws.com, 
    user ubuntu, command scp -v -f /home/ubuntu/jmeter.log
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 my-host.amazonaws.com [xx.xx.xxx.xx] port 22.
debug1: Connection established.
debug1: identity file /home/ubuntu/.ssh/id_rsa type -1
debug1: identity file /home/ubuntu/.ssh/id_rsa-cert type -1
debug1: identity file /home/ubuntu/.ssh/id_dsa type -1
debug1: identity file /home/ubuntu/.ssh/id_dsa-cert type -1
debug1: identity file /home/ubuntu/.ssh/id_ecdsa type -1
debug1: identity file /home/ubuntu/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/ubuntu/.ssh/id_ed25519 type -1
debug1: identity file /home/ubuntu/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8
debug1: Remote protocol version 2.0, remote software version 
    OpenSSH_6.6.1p1     Ubuntu-2ubuntu2.8
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8 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:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx
debug1: Host 'my-host.amazonaws.com' is known and matches the ECDSA host
    key.
debug1: Found key in /home/ubuntu/.ssh/known_hosts:1
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: /home/ubuntu/.ssh/id_xxx
debug1: Trying private key: /home/ubuntu/.ssh/id_yyy
debug1: Trying private key: /home/ubuntu/.ssh/id_abcde
debug1: Trying private key: /home/ubuntu/.ssh/id_zzzzzzz
debug1: No more authentication methods to try.
Permission denied (publickey).

Aqui está o registro detalhado da minha conexão SSH inicial:

$ ssh -v my-host.amazonaws.com -l ubuntu
OpenSSH_6.6.1, OpenSSL 1.0.1i 6 Aug 2014
debug1: Reading configuration data /c/Users/jdoe/.ssh/config
debug1: Connecting to my-host.amazonaws.com [xx.xxx.xxx.xxx] port 22.
debug1: Connection established.
debug1: identity file /c/Users/jdoe/.ssh/id_rsa type 1
debug1: identity file /c/Users/jdoe/.ssh/id_rsa-cert type -1
debug1: identity file /c/Users/jdoe/.ssh/id_dsa type -1
debug1: identity file /c/Users/jdoe/.ssh/id_dsa-cert type -1
debug1: identity file /c/Users/jdoe/.ssh/id_ecdsa type -1
debug1: identity file /c/Users/jdoe/.ssh/id_ecdsa-cert type -1
debug1: identity file /c/Users/jdoe/.ssh/id_ed25519 type -1
debug1: identity file /c/Users/jdoe/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1         
    Ubuntu-2ubuntu2.8
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8 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:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx
debug1: Host 'my-host.amazonaws.com' is known and matches the ECDSA host key.
debug1: Found key in /c/Users/jdoe/.ssh/known_hosts:10
debug1: ssh_ecdsa_verify: signature correct
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
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /c/Users/jdoe/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug1: key_parse_private2: missing begin marker
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
Authenticated to my-host.amazonaws.com ([xx.xxx.xxx.xxx]:22).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-95-generic x86_64)
    
por WEFX 28.10.2016 / 20:35

1 resposta

0

Você não está executando os dois comandos da mesma máquina ou do mesmo usuário.

Uma saída diz que /home/ubuntu/.ssh/id_rsa é usado, outro diz /c/Users/jdoe/.ssh/id_rsa

Então você provavelmente está usando a chave errada no caso do scp, vindo do diretório errado.

    
por marosg 31.10.2016 / 15:11