ssh-keygen "Key enrollment failed" for ed25519-sk: feature not supported, device not found
ssh-keygen -t ed25519-sk could not create the key on your security key. The last words of the message say why. Most often, the key lacks Ed25519: use ecdsa-sk.
You may need to touch your authenticator to authorize key generation.
Key enrollment failed: requested feature not supported
ssh-keygen -t ed25519-sk (or ecdsa-sk) asks the security key to create a new credential. "Enrollment" is that step. When it fails, ssh-keygen stops and no key file is written. The words after the colon come from a short list, and each points to a different cause.
"requested feature not supported"
The security key, or the FIDO library on your computer, cannot do what you asked.
- The key has no Ed25519. The OpenSSH 8.2 release notes say FIDO tokens must support ECDSA P-256 (
ecdsa-sk), while hardware support for Ed25519 (ed25519-sk) is less common. Create the key with ECDSA instead:ssh-keygen -t ecdsa-sk. - You asked for
-O residentor-O verify-required, and the key does not support it. These options need a FIDO2 key that can protect the credential; OpenSSH refuses to create such a key without that protection. Leave the option out, or use a newer key. - Your libfido2 is too old. OpenSSH needs libfido2 1.5.0 or later for resident and verify-required keys. Update the package that provides it.
"device not found"
ssh-keygen found no security key it could open.
- The key is not plugged in to this computer. If you run
ssh-keygeninside an SSH session, it looks for a key on the remote machine, not on the computer in front of you. The same goes for a virtual machine that has not been given the USB device. Generate the key on the machine the key is plugged into. - On Linux, your account cannot open the device. The libfido2 documentation says you may need a udev rule that gives your user access to the key's
hidrawdevice.
"invalid format"
This is the catch-all: the security key or its library failed in a way that has no more specific message. Look at the lines above it.
- "No FIDO SecurityKeyProvider specified" or "internal security key support not enabled" above it means this
ssh-keygenwas built without its built-in FIDO support. The OpenSSH 8.2 release notes explain that portable OpenSSH only includes it when built with--with-security-key-builtinand libfido2. Install an OpenSSH build that has it, or pointssh-keygen -w(or theSSH_SK_PROVIDERenvironment variable) at a FIDO provider library. - Nothing helpful above it. One reason is that the key was not touched before it gave up waiting. Run the command again and touch the key when asked. Add
-vto see the library's own error text.
PIN prompts and "Too many incorrect PINs"
If the key needs its PIN, ssh-keygen asks Enter PIN for authenticator:. That is not a failure. A wrong PIN prints PIN incorrect and asks again. After the second wrong PIN, ssh-keygen stops with Too many incorrect PINs; run it again to start over.
Resident keys usually need a PIN to be set on the key first. The ssh-keygen manual says so for -O resident.
"A resident key ... already exists. Overwrite key in token (y/n)?"
You asked for a resident key, and the security key already holds one for the same application (ssh: by default) and user. Answering y replaces the one stored on the security key, and logins that used the old key stop working. To keep both, give the new one a different user name with -O user=work.
"unknown key type ed25519-sk"
This ssh-keygen predates security key support, which arrived in OpenSSH 8.2. Check with ssh -V and update OpenSSH.
After the key is created
The server must accept security key types too. A server older than OpenSSH 8.2 rejects them at login. See Security keys (FIDO2) with SSH. If the key was created but logins later fail with "agent refused operation", see SSH "agent refused operation": signing failed and could not add identity.
Related
- Security keys (FIDO2) with SSH
- Key types and formats
- SSH "agent refused operation": signing failed and could not add identity
- SSH Load key "invalid format" and "error in libcrypto"
- SSH error messages, what each one means
- SSH with a FIDO security key never asks me to touch the key