I've just generated a ECDSA key with ssh-keygen:

ssh-keygen -t ecdsa -b 521 

I then proceeded to copy this key to my server:

cat .ssh/id_ecdsa.pub | ssh myserver "tee -a .ssh/authorized_keys"

I've verified that my key is in the file.

However, when I attempt to connect, my connection is rejected:

ssh -v -i .ssh/id_ecdsa myserver


OpenSSH_5.9p1 Debian-5ubuntu1.1, OpenSSL 1.0.1 14 Mar 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to myserver [] port 22.
debug1: Connection established.
debug1: identity file .ssh/id_ecdsa type 3
debug1: Checking blacklist file /usr/share/ssh/blacklist.ECDSA-521
debug1: Checking blacklist file /etc/ssh/blacklist.ECDSA-521
debug1: identity file .ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.1
debug1: match: OpenSSH_6.1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1.1
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: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA 10:27:b8:78:2c:e1:e3:42:8e:e3:66:c4:cc:4e:f1:c0
debug1: Host 'myserver' is known and matches the RSA host key.
debug1: Found key in /home/naftuli/.ssh/known_hosts:73
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_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering ECDSA public key: .ssh/id_ecdsa
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).

Found this in the server logs:

auth.info sshd[13874]: userauth_pubkey: unsupported public key algorithm: ecdsa-sha2-nistp521 [preauth]

Both my client and the server are using OpenSSH. The server's OpenSSH version is OpenSSH 6.1, my client's OpenSSH version is OpenSSH 5.9.

How can I tell which key algorithms are supported by my server?

  • OpenWRT 12.09 Attitude Adjustment. I can recompile the OpenSSH server if need be. Is there a way to at least list the supported algorithms? – Naftuli Kay Dec 5 '13 at 4:47

Like many other embedded systems, OpenWrt uses dropbear as its ssh server, not the more heavyweight OpenSSH that's commonly seen on Linux systems. Older versions of dropbear only support RSA and DSA keys; support for ECDSA was not added until version 2013.62 (which has only just been released a few days ago).

It should show up soon in Barrier Breaker (trunk); but you will not see it in Attitude Adjustment.

|improve this answer|||||
  • I've actually installed and configured OpenSSH on my OpenWRT router. That's why I'm surprised that it doesn't work. – Naftuli Kay Dec 5 '13 at 20:06
  • ie: I'm not using dropbear and it's been uninstalled. – Naftuli Kay Dec 5 '13 at 20:14
  • In that case, you're (1) on your own, and (2) apparently outside the bounds of what I'd expect in a professional environment. – Michael Hampton Dec 5 '13 at 20:22
  • I suppose so. I'll contact OpenWRT about it and see what I can do. OpenSSH is provided as a package in OpenWRT, so I'm wondering why that would put me on my own. – Naftuli Kay Dec 5 '13 at 20:27

ecdsa is supported from openssh-server version 5.7. What version of openssh-server are you running? run dpkg -l | grep openssh-server | awk '{print $3}' | cut -d: -f2 to find the version.

|improve this answer|||||

If your system is Red Hat Enterprise Linux 6.4 (or older) or Fedora 19 (or older), note ECDSA was removed from there. I don't have any details why was that (perhaps legal reasons): https://www.mail-archive.com/legal@lists.fedoraproject.org/msg00755.html

|improve this answer|||||
  • ECDSA is in RHEL 6.5. as part of openssl 1.0.1 and also note that the OP clarifies that they're using OpenWRT 12.09 – user9517 Dec 5 '13 at 17:09
  • Oh right, edited. – lzap Dec 6 '13 at 9:38
  • 3
    Yes, it were legal reasons. Still, to this day, not every distributor enables Elliptic Curve cryptography due to the patents; RedHat only enabled some curves, not ECC in general, after careful legal review, but those they did enable were NIST (and thus NSA) influenced. You may want to stay clear off ECC even if the reduced computing power is deceptively nice. – mirabilos Dec 6 '13 at 13:42

Leaving this here because this happened to me:

Day 1: Setting up a new machine, I copied keys in - mine first - and was able to log in fine.

Day 2: I can't log in with my ed25519 key. Huh? I add an RSA key; it works. I generate a new ed25519 key and it works... but my old one doesn't. WTF?

Turns out that after testing, I installed my key into root's .ssh/authorized_keys as a backup... and forgot to fix the permissions on that file. So openssh blacklisted my key, making me unable to log in. Fixing the perms on /root/.ssh/authorized_keys allowed me to log in as my user.

|improve this answer|||||

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.