[SOLVED] Ubuntu SSH ignoring RSA key
Client: Ubuntu 14.04 (software not up to date, but can ssh to lots of other systems).
/var/log/auth.log on server:
Mar 4 01:06:52 ubuntu sshd[4113]: Connection closed by 72.192.241.249 port 44844 [preauth]
(above only after I hit ctrl-C out of ssh on the client while it was prompting for a password).
Output from ssh -vvv:
ssh -vvv root@$host id
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /home/jack/.ssh/config
debug1: /home/jack/.ssh/config line 1: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to li572-161.members.linode.com [192.155.88.161] port 22.
debug1: Connection established.
debug3: Incorrect RSA1 identifier
debug3: Could not load "/home/jack/.ssh/id_rsa" as a RSA1 public key
debug1: identity file /home/jack/.ssh/id_rsa type 1
debug1: identity file /home/jack/.ssh/id_rsa-cert type -1
debug1: identity file /home/jack/.ssh/id_dsa type -1
debug1: identity file /home/jack/.ssh/id_dsa-cert type -1
debug1: identity file /home/jack/.ssh/id_ecdsa type -1
debug1: identity file /home/jack/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/jack/.ssh/id_ed25519 type -1
debug1: identity file /home/jack/.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.7
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.1
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.1 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug3: loadhostkeys: loading entries for host "li572-161.members.linode.com" from file "/home/jack/.ssh/knownhosts"
debug3: loadhostkeys: found key type ECDSA in file /home/jack/.ssh/knownhosts:73
debug3: load_hostkeys: loaded 1 keys
debug3: order_hostkeyalgs: prefer hostkeyalgs:
debug1: SSH2MSGKEXINIT sent
debug1: SSH2MSGKEXINIT received
debug2: kexparsekexinit:
debug2: kexparsekexinit:
debug2: kexparsekexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,
debug2: kexparsekexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,
debug2: kexparsekexinit:
debug2: kexparsekexinit:
debug2: kexparsekexinit: none,
debug2: kexparsekexinit: none,
debug2: kexparsekexinit:
debug2: kexparsekexinit:
debug2: kexparsekexinit: firstkexfollows 0
debug2: kexparsekexinit: reserved 0
debug2: kexparsekexinit:
debug2: kexparsekexinit: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519
debug2: kexparsekexinit:
debug2: kexparsekexinit:
debug2: kexparsekexinit:
debug2: kexparsekexinit:
debug2: kexparsekexinit: none,
debug2: kexparsekexinit: none,
debug2: kexparsekexinit:
debug2: kexparsekexinit:
debug2: kexparsekexinit: firstkexfollows 0
debug2: kexparsekexinit: reserved 0
debug2: mac_setup: setup
debug1: kex: server->client aes128-ctr
debug2: mac_setup: setup
debug1: kex: client->server aes128-ctr
debug1: sending SSH2MSGKEXECDHINIT
debug1: expecting SSH2MSGKEXECDHREPLY
debug1: Server host key: ECDSA ca:d2:b4:7e:36:17:9e:42:8c:6c:6f
debug3: loadhostkeys: loading entries for host "li572-161.members.linode.com" from file "/home/jack/.ssh/knownhosts"
debug3: loadhostkeys: found key type ECDSA in file /home/jack/.ssh/knownhosts:73
debug3: load_hostkeys: loaded 1 keys
debug3: loadhostkeys: loading entries for host "192.155.88.161" from file "/home/jack/.ssh/knownhosts"
debug3: loadhostkeys: found key type ECDSA in file /home/jack/.ssh/knownhosts:74
debug3: load_hostkeys: loaded 1 keys
debug1: Host 'li572-161.members.linode.com' is known and matches the ECDSA host key.
debug1: Found key in /home/jack/.ssh/known_hosts:73
debug1: sshecdsaverify: signature correct
debug2: kexderivekeys
debug2: set_newkeys: mode 1
debug1: SSH2MSGNEWKEYS sent
debug1: expecting SSH2MSGNEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2MSGNEWKEYS received
debug1: SSH2MSGSERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2MSGSERVICE_ACCEPT received
debug2: key: /home/jack/.ssh/id_rsa (0x7f3a472476d0),
debug2: key: /home/jack/.ssh/id_dsa ((nil)),
debug2: key: /home/jack/.ssh/id_ecdsa ((nil)),
debug2: key: /home/jack/.ssh/id_ed25519 ((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: authmethodisenabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/jack/.ssh/id_rsa
debug3: sendpubkeytest
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/jack/.ssh/id_dsa
debug3: no such identity: /home/jack/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /home/jack/.ssh/id_ecdsa
debug3: no such identity: /home/jack/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /home/jack/.ssh/id_ed25519
debug3: no such identity: /home/jack/.ssh/id_ed25519: No such file or directory
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethodisenabled password
debug1: Next authentication method: password
Permissions of .ssh on client:
drwx–---- 2 jack jack 4096 Mar 3 18:32 .
drwxr-xr-x 37 jack jack 4096 Mar 3 18:31 ..
-rw-r--r-- 1 jack jack 990 Nov 2 19:07 authorized_keys
-rw------- 1 jack jack 135 Aug 20 2015 config
-rw------- 1 jack jack 1675 Nov 2 19:06 id_rsa
-rw-r--r-- 1 jack jack 396 Nov 2 19:06 id_rsa.pub
-rw------- 1 jack jack 30264 Mar 3 18:18 known_hosts
-rw------- 1 jack jack 28050 Feb 28 23:56 known_hosts.old
On server:
drwx------ 2 root root 4096 Mar 3 23:11 .
drwxr-xr-x 4 root root 4096 Mar 3 23:18 ..
-rw-r--r-- 1 root root 1411 Mar 3 23:11 authorized_keys
-rw------- 1 root root 135 Mar 3 23:11 config
-rw------- 1 root root 20972 Mar 3 23:11 known_hosts
Why is the server not accepting my RSA key and then not logging anything about rejecting it?
--
Jack Waugh
2 Replies
debug3: Incorrect RSA1 identifier
debug3: Could not load "/home/jack/.ssh/id_rsa" as a RSA1 public key
Check that the id_rsa file contains the correct key
-----BEGIN RSA PRIVATE KEY-----
…
-----END RSA PRIVATE KEY-----
Also check that the output of: (which should be inside the id_rsa.pub, but has no bearing)
ssh-keygen -y -f ~/.ssh/id_rsa
````
matches one of the lines in the authorized_keys on the host
Jack Waugh