Skip to content

Keyboard-interactive authentication

Keyboard-interactive authentication (RFC 4256) lets an SSH server ask the client any number of questions during sign-in. It is how most servers deliver a second factor: a code from an authenticator app, a YubiKey OTP, a Duo push or passcode, an RSA SecurID token. ZestSSH answers the password part for you and asks you for the rest.

This page is about two-factor sign-in on the SSH servers you connect to. For your ZestSSH account, see Two-step sign-in.

Platform Status
Android Full support
iOS Full support
Windows Full support
macOS Full support
Linux Full support
  1. Connect as usual.
  2. If the server asks for your password and one is saved (in a password key, or as a key’s Password, tried after the key), ZestSSH answers it for you.
  3. If the server asks for anything else, such as Verification code:, a Sign-in step dialog appears with the host and the server’s question. Type the answer and choose Send.
  4. Choose Cancel to stop signing in. The session closes, the same as cancelling a password prompt.

The dialog says the questions come from the server, not from ZestSSH. A server can ask for anything, so answer only what you expect it to ask.

The dialog appears for terminal sessions (and SFTP, which runs over the same connection), for each jump host on the way to a server, for serial console sessions, for Test full connection in the host editor, and when Install on hosts… or a workflow you run signs in. It shows once, over whatever screen is open, on a phone and on a computer. While the app is locked it waits, and it appears once you unlock.

A prompt gets your saved password only when it is a real password prompt: it does not echo, and its text is Password: or <user>'s password: (case-insensitive). The password is sent at most once per connection. If the server asks for a password again, the saved one was not accepted, so ZestSSH asks you instead of repeating it into an account lockout.

A prompt such as Verification code:, Passcode: or Enter PASSCODE: never receives your password, so it cannot end up in the server’s two-factor log.

Every other prompt goes to you, exactly as the server wrote it, with nothing filled in.

  • Answers the server marks as secret are hidden. Use the eye button to show one; in recording mode ZestSSH asks first.
  • Secret answers are kept out of the keyboard’s suggestions and learning.
  • Several prompts in one step appear together. Enter moves to the next field and sends from the last.
  • The server’s text is cleaned before it is shown: control characters, direction overrides and invisible characters are removed, and very long text is shortened.
  • Your answers are never saved or written to logs, and neither is the server’s text. The connection log records only how many questions were asked and whether you answered or cancelled.

Some servers send a message instead of a question, for example “Pushed a login request to your phone”, and then wait while you approve on your phone. ZestSSH notes the message in the connection log and waits. Once a server has asked anything, it has up to 120 seconds to reply, instead of the usual 15.

Some servers send a login message with a link before the sign-in, and wait while you approve on that web page (Tailscale SSH in check mode does this). That is not a question, so no Sign-in step dialog appears. Instead, a Finish signing in dialog shows the message, with Open link, Copy link and Cancel, and ZestSSH waits up to 5 minutes for the server. See Sign-in links.

A link inside a server’s question is shown as plain text, with no button to open it.

The 15-second sign-in timeout stops while a question is on screen, and while a hardware key or SSH agent waits for you to touch it or approve. After a login message with a link, the server is given up to 5 minutes instead, and that dialog closes on its own when the sign-in ends (see Sign-in links). Most servers end an unanswered sign-in after about two minutes on their side (OpenSSH’s LoginGraceTime is 120 seconds by default); when that happens the dialog closes on its own. If nothing can show the question, ZestSSH gives up after three minutes.

Server Monitor and automations that run by themselves (a scheduled task, a run started by another app) never show the dialog. They give your saved password to a real password prompt, once, and cannot answer anything else, so a server that requires a one-time code refuses them. Depending on how the run connects, either the server refuses the empty answer, or ZestSSH stops the run and says: “The server asked a question at sign-in that only a person can answer (a code, or a password that is not saved), and nobody is there to answer it. Open this host yourself.” A run with nobody there also signs in only with keys switched to Allow unattended runs. For these, use a key that the server accepts without a second factor.

Server setup What happens
PAM password, macOS sshd Saved password answered automatically
Password, then a one-time code Password answered; you are asked for the code
Key, then a one-time code (AuthenticationMethods publickey,keyboard-interactive) Key used; you are asked for the code
Duo push Nothing to answer; approve on your phone
Tailscale SSH in check mode A Finish signing in dialog with the server’s link; open it and approve within 5 minutes (Sign-in links)
Duo passcode or menu (Passcode or option (1-3):) You are asked; your answer is visible as you type, as the server requests
Wrong saved password, and the server asks again Saved password sent once; then you are asked
Password change required at sign-in You are asked for the current and new passwords
  • One shared answerer handles every connection type, so the rules above are the same for terminals, jump hosts, serial consoles, connection tests and automation.
  • The saved password goes only to a real password prompt, once.
  • The dialog names the host and marks the questions as the server’s, because a malicious server could ask for credentials it should not have.
  • Nothing you type into the dialog is logged or stored.
  • Check the time on your phone: authenticator codes depend on the clock.
  • If the current code is about to expire, wait for the next one.
  • Many servers allow only a few tries per sign-in and then disconnect. Connect again.
  • If the app is locked, unlock it: the dialog waits for that.
  • Background connections (Server Monitor, automations that run by themselves) never show the dialog.

macOS sshd uses keyboard-interactive authentication by default. Ensure:

  • The password is saved correctly in the key.
  • The key is set in the host’s Key field.
  • The server’s sshd_config has KbdInteractiveAuthentication yes (ChallengeResponseAuthentication yes on older macOS versions).

Q: Does ZestSSH work with Google Authenticator, Authy or other TOTP codes on SSH servers? A: Yes. When the server asks for the code, ZestSSH shows its question and you type the code from your app.

Q: Why not answer every prompt with the saved password? A: A malicious server could ask for “your email password” or “your bank PIN”. ZestSSH answers only a real password prompt, once; everything else is up to you.

Q: Can automations sign in to a server that requires a one-time code? A: No. Nobody is there to type the code, so the sign-in stops. Use a key that the server accepts without a second factor, and switch it to Allow unattended runs.