Public key authentication fails - SSH

This is a discussion on Public key authentication fails - SSH ; I am trying to set up public key authentication between two linux boxes on our network. Both are using OpenSSH 4.3p2. On the local machine, I created a key using: ssh-keygen -t dsa At the prompt for passphrase, I simply ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Public key authentication fails

  1. Public key authentication fails

    I am trying to set up public key authentication between two linux boxes
    on our network. Both are using OpenSSH 4.3p2. On the local machine, I
    created a key using:

    ssh-keygen -t dsa

    At the prompt for passphrase, I simply hit enter and then enter again
    when asked to confirm. It create ~.ssh/id_dsa and ~.ssh/id_dsa.pub. I
    then secure copied the pub file to the remote box:

    scp id_dsa.pub myuser@remotebox.com:

    Then I ssh'd to the remote box and added the contents of id_dsa.pub to
    ~.ssh/authorized_keys like so:

    cat id_dsa.pub >> .ssh/authorized_keys

    I then made sure permissions where set correctly:
    chmod 700 .ssh
    chmod 600 .ssh/authorized_keys

    Now, back on the local machine, I try to ssh into the remote "myuser"
    acount, but I still get asked for a password. Here's the verbose
    output:

    [root@local .ssh]# ssh -vv -2 -l myuser remotebox.com
    OpenSSH_4.3p2, OpenSSL 0.9.7a Feb 19 2003
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug2: ssh_connect: needpriv 0
    debug1: Connecting to remotebox.com [192.168.101.10] port 22.
    debug1: Connection established.
    debug1: permanently_set_uid: 0/0
    debug1: identity file /root/.ssh/id_rsa type -1
    debug2: key_type_from_name: unknown key type '-----BEGIN'
    debug2: key_type_from_name: unknown key type '-----END'
    debug1: identity file /root/.ssh/id_dsa type 2
    debug1: Remote protocol version 1.99, remote software version
    OpenSSH_4.3
    debug1: match: OpenSSH_4.3 pat OpenSSH*
    debug1: Enabling compatibility mode for protocol 2.0
    debug1: Local version string SSH-2.0-OpenSSH_4.3
    debug2: fd 3 setting O_NONBLOCK
    debug1: SSH2_MSG_KEXINIT sent
    debug1: SSH2_MSG_KEXINIT received
    debug2: kex_parse_kexinit:
    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,rijndael-cbc@lysator.liu.se,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,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
    debug2: kex_parse_kexinit:
    hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
    debug2: kex_parse_kexinit:
    hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
    debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
    debug2: kex_parse_kexinit: none,zlib@openssh.com,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-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,rijndael-cbc@lysator.liu.se,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,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
    debug2: kex_parse_kexinit:
    hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
    debug2: kex_parse_kexinit:
    hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
    debug2: kex_parse_kexinit: none,zlib@openssh.com
    debug2: kex_parse_kexinit: none,zlib@openssh.com
    debug2: kex_parse_kexinit:
    debug2: kex_parse_kexinit:
    debug2: kex_parse_kexinit: first_kex_follows 0
    debug2: kex_parse_kexinit: reserved 0
    debug2: mac_init: found hmac-md5
    debug1: kex: server->client aes128-cbc hmac-md5 none
    debug2: mac_init: found hmac-md5
    debug1: kex: client->server aes128-cbc 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: 123/256
    debug2: bits set: 522/1024
    debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
    debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
    debug1: Host 'remotebox.com' is known and matches the RSA host key.
    debug1: Found key in /root/.ssh/known_hosts:1
    debug2: bits set: 511/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: SSH2_MSG_SERVICE_REQUEST sent
    debug2: service_accept: ssh-userauth
    debug1: SSH2_MSG_SERVICE_ACCEPT received
    debug2: key: /root/.ssh/id_rsa ((nil))
    debug2: key: /root/.ssh/id_dsa (0x8091b00)
    debug1: Authentications that can continue:
    publickey,password,keyboard-interactive
    debug1: Next authentication method: publickey
    debug1: Trying private key: /root/.ssh/id_rsa
    debug1: Offering public key: /root/.ssh/id_dsa
    debug2: we sent a publickey packet, wait for reply
    debug1: Authentications that can continue:
    publickey,password,keyboard-interactive
    debug2: we did not send a packet, disable method
    debug1: Next authentication method: keyboard-interactive
    debug2: userauth_kbdint
    debug2: we sent a keyboard-interactive packet, wait for reply
    debug1: Authentications that can continue:
    publickey,password,keyboard-interactive
    debug2: we did not send a packet, disable method
    debug1: Next authentication method: password
    myuser@remotebox.com's password:

    Once I give myuser's password, I am logged in. I expected to be able
    to login without a password.

    In case it is meaningful, here is the sshd_config file on
    remotebox.com. I took the liberty of removing the lines that are
    commented out.:

    [root@staging root]# cat /etc/ssh/sshd_config
    # $OpenBSD: sshd_config,v 1.73 2005/12/06 22:38:28 reyk Exp $

    Protocol 2,1

    # Authentication:
    RSAAuthentication yes
    PubkeyAuthentication yes
    #AuthorizedKeysFile .ssh/authorized_keys

    # override default of no subsystems
    Subsystem sftp /usr/local/libexec/sftp-server

    Have I missed something? I expected to be able to login without giving
    password, but I still get asked.

    Thanks in advance,

    Sean


  2. Re: Public key authentication fails


    > I then made sure permissions where set correctly:
    > chmod 700 .ssh
    > chmod 600 .ssh/authorized_keys


    chmod 755 ~

    --
    Richard Silverman
    res@qoxp.net


  3. Re: Public key authentication fails

    Thanks! After two days of frustration, it now works.

    Sean


+ Reply to Thread