0

I am trying to setup passwordless login using SSH key in Raspbmc and is not working. Following are the things that I have tried so far.

  • I copied the ssh key using ssh-copy-id command.
  • The permission to ~/.ssh, authorized_keys and public/private keys are correct in the local machine as well as Raspbmc
  • I am not seeing anything in the authlog (snipped attached below)
  • I tried various levels of verbose -v to -vvvv but nothing shows up. (snippet attached below)

autholog snippet

Aug 10 13:27:23 raspbmc dropbear[1260]: Child connection from 192.168.1.2:41488
Aug 10 13:27:30 raspbmc dropbear[1260]: Password auth succeeded for 'pi' from 192.168.1.2:41488
Aug 10 13:27:30 raspbmc dropbear[1261]: lastlog_perform_login: Couldn't stat /var/log/lastlog: No such file or directory
Aug 10 13:27:30 raspbmc dropbear[1261]: lastlog_openseek: /var/log/lastlog is not a file or directory!
Aug 10 13:27:30 raspbmc sudo:       pi : TTY=pts/1 ; PWD=/home/pi ; USER=root ; COMMAND=/bin/sh /scripts/configure-pi-user.sh
Aug 10 13:27:30 raspbmc sudo: pam_unix(sudo:session): session opened for user root by pi(uid=0)
Aug 10 13:27:30 raspbmc sudo: pam_unix(sudo:session): session closed for user root
Aug 10 13:27:52 raspbmc dropbear[1260]: Exit (pi): Disconnect received

ssh verbose output

ssh pi@raspbmc.local -v
OpenSSH_5.9p1, OpenSSL 0.9.8x 10 May 2012
debug1: Reading configuration data /Users/sudarm/.ssh/config
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to raspbmc.local [192.168.1.6] port 22.
debug1: Connection established.
debug1: identity file /Users/sudarm/.ssh/id_rsa type 1
debug1: identity file /Users/sudarm/.ssh/id_rsa-cert type -1
debug1: identity file /Users/sudarm/.ssh/id_dsa type -1
debug1: identity file /Users/sudarm/.ssh/id_dsa-cert type -1
debug1: Remote protocol version 2.0, remote software version dropbear_2012.55
debug1: no match: dropbear_2012.55
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_KEXDH_REPLY
debug1: Server host key: RSA ea:ac:7e:cf:7b:f9:58:81:23:99:08:be:d4:5a:46:14
debug1: Host 'raspbmc.local' is known and matches the RSA host key.
debug1: Found key in /Users/sudarm/.ssh/known_hosts:44
debug1: ssh_rsa_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,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/sudarm/.ssh/id_rsa_sm
debug1: Authentications that can continue: publickey,password
debug1: Offering RSA public key: /Users/sudarm/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /Users/sudarm/.ssh/id_dsa
debug1: Next authentication method: password
pi@raspbmc.local's password: 
debug1: Authentication succeeded (password).
Authenticated to raspbmc.local ([192.168.1.6]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
pi@raspbmc:~$ exit
logout

debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: free: client-session, nchannels 1
Connection to raspbmc.local closed.
Transferred: sent 2776, received 2144 bytes, in 3.3 seconds
Bytes per second: sent 845.2, received 652.8
debug1: Exit status 0

PS: I facing the same problem as this question, but have tried all solution that are given there. So please don't close this as duplicate.

  • 1
    It did not like your id_dsa file. Try copying over id_dsa.pub manually. – Thorbjørn Ravn Andersen Aug 10 '13 at 12:16
  • @ThorbjørnRavnAndersen finally got it working. I had a line break in my public key. How did you find it out from the above log messages? – Sudar Aug 10 '13 at 14:25
2

The private key in your id_dsa file was not found to match the remote copy of the public key. This can be deduced as the "Trying private key" was not followed up by further handshake communication based on the key but continued to the password method.

debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /Users/sudarm/.ssh/id_dsa
debug1: Next authentication method: password
pi@raspbmc.local's password: 

The typical reason for this is that the remote copy of the public key was somehow changed during transfer so it is not identical to the original.

  • Thanks for the explanation. As I said, my public key has a line break in authorized_keys file. – Sudar Aug 10 '13 at 15:44
0

Finally got it working.

The issue was that I had a line break in my authorized_keys file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.