Strovent SystemsSign in
Reference

SSH with a FIDO security key never asks me to touch the key

When ssh shows "Confirm user presence for key", when the prompt goes through ssh-askpass instead, and how no-touch-required keys skip the touch altogether.

A FIDO security key normally needs a touch for every SSH login (user presence). OpenSSH tells you when to touch it, but where that message appears depends on who is signing: ssh itself, or ssh-agent.

ssh signs: the message is in your terminal

When ssh uses the key file directly and the key requires user presence, it prints:

Confirm user presence for key ED25519-SK SHA256:…

then waits for the touch. It writes this to the terminal when standard error is a terminal. Otherwise, and in batch mode, it tries the SSH_ASKPASS program instead.

ssh-agent signs: the message goes to ssh-askpass

If the key is loaded in ssh-agent (see Use an ed25519-sk security key with ssh-agent: ssh-add, providers and macOS), the agent does the signing, and ssh itself prints nothing about the touch. The agent shows the same "Confirm user presence" text only through the SSH_ASKPASS program, and only if:

  • DISPLAY or WAYLAND_DISPLAY is set, or SSH_ASKPASS_REQUIRE=force, and
  • an askpass program is set or installed.

Without those, there is no message at all, but the key still has to be touched. A login that seems to hang may just be waiting for the touch.

The key really does not need a touch

A key can be made so that it skips user presence:

  • ssh-keygen -O no-touch-required when the key is created. The current ssh-keygen manual also lets ssh-keygen -p change it later with -O touch-required or -O no-touch-required; with an older OpenSSH that does not accept this, make a new key.
  • On the server, sshd still requires user presence by default. It accepts a signature without a touch only if the authorized_keys line for that key has the no-touch-required option.
  • If the server's sshd_config sets PubkeyAuthOptions touch-required, the server ignores that authorized_keys option and always requires a touch.

So if logins work with no touch at all, both the key and the server's authorized_keys line have been set up that way. To require the touch again, remove no-touch-required from the authorized_keys line, and change or replace the key.

Sources

Spotted a mistake? Email [email protected].