Passwordless ssh login not working [SOLVED]

I can’t seem to get passwordless login to work - anyone see what I’m doing wrong please?

I’ve set up my keys on my local machine, and copied the key.pub to authorized_keys in the .ssh folder of my root account on the server.
I have also set permissions as: chmod 700 ~/.ssh/authorized_keys

In /etc/ssh/sshd_config I have set/uncommented:

PermitRootLogin without-password
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys

But when I try to log in I get:

OpenSSH_5.6p1, OpenSSL 0.9.8r 8 Feb 2011 Warning: Identity file .ssh/myname not accessible: No such file or directory. debug1: Reading configuration data /etc/ssh_config debug1: Applying options for * debug2: ssh_connect: needpriv 0 debug1: Connecting to my.ser.ver.ip [my.ser.ver.ip] port 8784. debug1: Connection established. debug2: key_type_from_name: unknown key type '-----BEGIN' debug2: key_type_from_name: unknown key type '-----END' debug1: identity file /Users/Name/.ssh/id_rsa type 1 debug1: identity file /Users/Name/.ssh/id_rsa-cert type -1 debug1: identity file /Users/Name/.ssh/id_dsa type -1 debug1: identity file /Users/Name/.ssh/id_dsa-cert type -1 debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3 debug1: match: OpenSSH_5.3 pat OpenSSH* debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_5.6 debug2: fd 3 setting O_NONBLOCK debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received 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-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-dss-cert-v00@openssh.com,ssh-rsa,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,rijndael-cbc@lysator.liu.se 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,rijndael-cbc@lysator.liu.se debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96 debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,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-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-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se 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,rijndael-cbc@lysator.liu.se debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96 debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,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_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: 137/256 debug2: bits set: 505/1024 debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY debug1: checking without port identifier debug1: Host 'my.ser.ver.ip' is known and matches the RSA host key. debug1: Found key in /Users/Name/.ssh/known_hosts:9 debug1: found matching key w/out port debug2: bits set: 503/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: .ssh/myname (0x7fb728424c20) debug2: key: /Users/Name/.ssh/id_rsa (0x7fb728417c90) debug2: key: /Users/Name/.ssh/id_dsa (0x0) debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password debug1: Next authentication method: publickey debug1: Offering RSA public key: .ssh/myname debug2: we sent a publickey packet, wait for reply debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password debug1: Offering RSA public key: /Users/Name/.ssh/id_rsa debug2: we sent a publickey packet, wait for reply debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password debug1: Trying private key: /Users/Name/.ssh/id_dsa debug2: we did not send a packet, disable method debug1: Next authentication method: password root@my.ser.ver.ip's password:

And the contents of /var/log/secure say:

Jun 21 02:13:55 server sshd[5967]: Connection from 2.324.350.78 port 54327 Jun 21 02:13:55 server sshd[5967]: debug1: Client protocol version 2.0; client software version OpenSSH_5.6 Jun 21 02:13:55 server sshd[5967]: debug1: match: OpenSSH_5.6 pat OpenSSH* Jun 21 02:13:55 server sshd[5967]: debug1: Enabling compatibility mode for protocol 2.0 Jun 21 02:13:55 server sshd[5967]: debug1: Local version string SSH-2.0-OpenSSH_5.3 Jun 21 02:13:55 server sshd[5968]: debug1: permanently_set_uid: 74/74 Jun 21 02:13:55 server sshd[5968]: debug1: list_hostkey_types: ssh-rsa,ssh-dss Jun 21 02:13:55 server sshd[5968]: debug1: SSH2_MSG_KEXINIT sent Jun 21 02:13:55 server sshd[5968]: debug1: SSH2_MSG_KEXINIT received Jun 21 02:13:55 server sshd[5968]: debug1: kex: client->server aes128-ctr hmac-md5 none Jun 21 02:13:55 server sshd[5968]: debug1: kex: server->client aes128-ctr hmac-md5 none Jun 21 02:13:55 server sshd[5968]: debug1: SSH2_MSG_KEX_DH_GEX_REQUEST received Jun 21 02:13:55 server sshd[5968]: debug1: SSH2_MSG_KEX_DH_GEX_GROUP sent Jun 21 02:13:55 server sshd[5968]: debug1: expecting SSH2_MSG_KEX_DH_GEX_INIT Jun 21 02:13:55 server sshd[5968]: debug1: SSH2_MSG_KEX_DH_GEX_REPLY sent Jun 21 02:13:55 server sshd[5968]: debug1: SSH2_MSG_NEWKEYS sent Jun 21 02:13:55 server sshd[5968]: debug1: expecting SSH2_MSG_NEWKEYS Jun 21 02:13:55 server sshd[5968]: debug1: SSH2_MSG_NEWKEYS received Jun 21 02:13:55 server sshd[5968]: debug1: KEX done Jun 21 02:13:55 server sshd[5968]: debug1: userauth-request for user root service ssh-connection method none Jun 21 02:13:55 server sshd[5968]: debug1: attempt 0 failures 0 Jun 21 02:13:55 server sshd[5967]: debug1: PAM: initializing for "root" Jun 21 02:13:55 server sshd[5967]: debug1: PAM: setting PAM_RHOST to "2.324.350.78" Jun 21 02:13:55 server sshd[5967]: debug1: PAM: setting PAM_TTY to "ssh" Jun 21 02:13:55 server sshd[5968]: debug1: userauth-request for user root service ssh-connection method publickey Jun 21 02:13:55 server sshd[5968]: debug1: attempt 1 failures 0 Jun 21 02:13:55 server sshd[5968]: debug1: test whether pkalg/pkblob are acceptable Jun 21 02:13:55 server sshd[5967]: debug1: temporarily_use_uid: 0/0 (e=0/0) Jun 21 02:13:55 server sshd[5967]: debug1: trying public key file /root/.ssh/authorized_keys Jun 21 02:13:55 server sshd[5967]: debug1: fd 4 clearing O_NONBLOCK Jun 21 02:13:55 server sshd[5967]: debug1: restore_uid: 0/0 Jun 21 02:13:55 server sshd[5967]: debug1: temporarily_use_uid: 0/0 (e=0/0) Jun 21 02:13:55 server sshd[5967]: debug1: trying public key file /root/.ssh/authorized_keys Jun 21 02:13:55 server sshd[5967]: debug1: fd 4 clearing O_NONBLOCK Jun 21 02:13:55 server sshd[5967]: debug1: restore_uid: 0/0 Jun 21 02:13:55 server sshd[5967]: Failed publickey for root from 2.324.350.78 port 54327 ssh2 Jun 21 02:13:55 server sshd[5968]: debug1: userauth-request for user root service ssh-connection method publickey Jun 21 02:13:55 server sshd[5968]: debug1: attempt 2 failures 1 Jun 21 02:13:55 server sshd[5968]: debug1: test whether pkalg/pkblob are acceptable Jun 21 02:13:55 server sshd[5967]: debug1: temporarily_use_uid: 0/0 (e=0/0) Jun 21 02:13:55 server sshd[5967]: debug1: trying public key file /root/.ssh/authorized_keys Jun 21 02:13:55 server sshd[5967]: debug1: fd 4 clearing O_NONBLOCK Jun 21 02:13:55 server sshd[5967]: debug1: restore_uid: 0/0 Jun 21 02:13:55 server sshd[5967]: debug1: temporarily_use_uid: 0/0 (e=0/0) Jun 21 02:13:55 server sshd[5967]: debug1: trying public key file /root/.ssh/authorized_keys Jun 21 02:13:55 server sshd[5967]: debug1: fd 4 clearing O_NONBLOCK Jun 21 02:13:55 server sshd[5967]: debug1: restore_uid: 0/0 Jun 21 02:13:55 server sshd[5967]: Failed publickey for root from 2.324.350.78 port 54327 ssh2

Anyone see what I’m doing wrong? I have set password log-ins many times before but haven’t had this problem before :confused:

It is most likely a permission issue with your home and/or .ssh and/or authoriz… file.

Here are my permissions:

chmod 700 ~/.ssh chmod 600 ~/.ssh/authorized_keys

-rw------- 1 root root 817 Jun 21 14:36 authorized_keys
drwx------ 2 root root 4.0K Jun 21 14:36 .ssh

Do I need to check anything else?
Is SSHD able to read these files as they are in the root ~/

EDIT: FIXED, duh (!!!) running the command with -vvv showed me my RSA file was broke - ran ‘ssh-keygen -t rsa’ for a new one and it’s working now :slight_smile:

Thanks!