SSH pedindo senha após ssh-copy-id

3

Eu criei uma chave na minha máquina com o ssh-keygen. Eu copiei a chave para a máquina remota usando ssh-copy-id.

Tentou se conectar à máquina remota, mas me perguntou a senha. Ambas as máquinas são Ubuntu (local 11,04, controle remoto 8.04)

EDIT (saída com verbose extra)

Aqui está o detalhado do ssh:

    OpenSSH_5.8p1 Debian-1ubuntu3, OpenSSL 0.9.8o 01 Jun 2010
debug1: Reading configuration data /home/leandro/.ssh/config
debug1: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 192.168.1.217 [192.168.1.217] port 22.
debug1: Connection established.
debug3: Incorrect RSA1 identifier
debug3: Could not load "/home/leandro/.ssh/id_rsa" as a RSA1 public key
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug3: key_read: missing keytype
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug2: key_type_from_name: unknown key type '-----END'
debug3: key_read: missing keytype
debug1: identity file /home/leandro/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /home/leandro/.ssh/id_rsa-cert type -1
debug1: identity file /home/leandro/.ssh/id_dsa type -1
debug1: identity file /home/leandro/.ssh/id_dsa-cert type -1
debug1: identity file /home/leandro/.ssh/id_ecdsa type -1
debug1: identity file /home/leandro/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.7p1 Debian-8ubuntu1
debug1: match: OpenSSH_4.7p1 Debian-8ubuntu1 pat OpenSSH_4*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.8p1 Debian-1ubuntu3
debug2: fd 3 setting O_NONBLOCK
debug3: load_hostkeys: loading entries for host "192.168.1.217" from file "/home/leandro/.ssh/known_hosts"
debug3: load_hostkeys: found key type RSA in file /home/leandro/.ssh/known_hosts:6
debug3: load_hostkeys: loaded 1 keys
debug3: order_hostkeyalgs: prefer hostkeyalgs: [email protected],[email protected],ssh-rsa
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: [email protected],[email protected],ssh-rsa,[email protected],[email protected],[email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-dss
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,[email protected],zlib
debug2: kex_parse_kexinit: none,[email protected],zlib
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: first_kex_follows 0 
debug2: kex_parse_kexinit: reserved 0 
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,[email protected],aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,[email protected],aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,[email protected]
debug2: kex_parse_kexinit: none,[email protected]
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: first_kex_follows 0 
debug2: kex_parse_kexinit: reserved 0 
debug2: mac_setup: found hmac-md5
debug1: kex: server->client aes128-ctr hmac-md5 none
debug2: mac_setup: found hmac-md5
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
debug2: dh_gen_key: priv key bits set: 132/256
debug2: bits set: 527/1024
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA 72:d5:e9:a2:09:46:e5:f2:e9:65:39:56:ba:f8:bc:38
debug3: load_hostkeys: loading entries for host "192.168.1.217" from file "/home/leandro/.ssh/known_hosts"
debug3: load_hostkeys: found key type RSA in file /home/leandro/.ssh/known_hosts:6
debug3: load_hostkeys: loaded 1 keys
debug1: Host '192.168.1.217' is known and matches the RSA host key.
debug1: Found key in /home/leandro/.ssh/known_hosts:6
debug2: bits set: 555/1024
debug1: ssh_rsa_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /home/leandro/.ssh/id_rsa (0x21ef1040)
debug2: key: /home/leandro/.ssh/id_dsa ((nil))
debug2: key: /home/leandro/.ssh/id_ecdsa ((nil))
debug1: Authentications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
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/leandro/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/leandro/.ssh/id_dsa
debug3: no such identity: /home/leandro/.ssh/id_dsa
debug1: Trying private key: /home/leandro/.ssh/id_ecdsa
debug3: no such identity: /home/leandro/.ssh/id_ecdsa
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
[email protected]'s password: 

leandro@FiberWork72:~$ cd ~/.ssh/
leandro@FiberWork72:~/.ssh$ ls
config  id_rsa  id_rsa.pub  known_hosts  known_hosts.bkp  known_hosts.old

EDITAR:

Ok. Eu noto algo aqui. Eu estava olhando para o ~ / .ssh / authorized_keys e percebi que no final da chave está escrito:

me@my_computer_name 

em vez de:

me@my_computer_ip

Eu não sei se tenho algo a ver com isso, mas ...

    
por lcguida 30.05.2012 / 16:43

4 respostas

3

Este tag wiki tem boas informações sobre ssh e como solucionar alguns problemas básicos.

Meu primeiro palpite seria verificar as permissões em ~/.ssh e garantir que ele não seja gravável por nenhum outro usuário além de você. Você pode ler mais sobre aqui .

    
por 30.05.2012 / 16:56
2

Você nomeou sua chave como algo diferente de id_rsa, id_dsa ou id_ecdsa?

Por padrão, o ssh tentará apenas com esses nomes de chaves. Se você escolheu outro, sem pânico, você pode especificar o nome da chave usando -i ou especificá-lo de uma vez por todas no seu arquivo ~ ssh / config.

Exemplo com -i (talvez você precise adicionar o ~ / .ssh / antes do nome da chave, não me lembro):

ssh -i <your_priv_key_name> [email protected]

Exemplo de ~ / .ssh / config

Host 192.168.1.217
  IdentityFile ~/.ssh/<your_priv_key_name>
    
por 30.05.2012 / 17:48
1

Assumindo que "myuser" é um usuário válido no sistema remoto, a chave precisa ser colocada nos usuários ~ / .ssh / authorized_keys (se estiver usando a configuração padrão).

Verifique seu sshd_config no servidor remoto para assegurar que o arquivo authkey deve estar, procure a linha AuthorizedKeysFile .

    
por 30.05.2012 / 17:16
0

Da sua saída detalhada

debug1: Connecting to 192.168.1.217 [192.168.1.217] port 22.
debug1: Connection established.
debug3: Incorrect RSA1 identifier
debug3: Could not load "/home/leandro/.ssh/id_rsa" as a RSA1 public key
debug2: key_type_from_name: unknown key type '-----BEGIN'

Eu posso ver que você está tentando se conectar ao 192.168.1.217 através da porta 22 usando ssh. Mas a chave privada "/home/leandro/.ssh/id_rsa" não está carregada. Parece que o problema está na parte chave.

Siga esta URL: link

Ele mostra como criar uma chave rsa e atribuí-la a um usuário válido. Tente criar chave pública e privada como usuário root e copie a chave pública para o diretório .ssh do usuário válido da máquina remota e use a chave privada para fazer o login.

Verifique também o seu iptables ou ufw, se houver.

    
por 09.07.2013 / 08:42

Tags